We will learn how to convert variable arguments by using rest operator in JavaScript.

.sass-btn {
color: #fff;
background-color: #0069d9;
margin: 5px;
@include button-size();
@include box-shadow(0px 4px 5px #, 2px 6px 10px #);
} @mixin box-shadow($shadows...) {
-moz-box-shadow: $shadows;
-webkit-box-shadow: $shadows;
box-shadow: $shadows;
}

Scss "$shadows..." the same as "...shadows" in Javascript.

export const boxShadow = (...shadows) => `
-moz-box-shadow: ${shadows};
-webkit-box-shadow: ${shadows};
box-shadow: ${shadows};
`

interesting thing is ...shadows in Javascript is an Array, but if we put into ${}, then it conver to a string:

const shadows = ['red', 'blue'];

console.log(`${shadows}`); // red, blue

最新文章

  1. 腾讯 auth_token
  2. 【C#公共帮助类】分页逻辑处理类
  3. Java中的数组
  4. C#中的IntPtr类型
  5. IOS 使用webview 显示 doc/docx/xls/pdf等
  6. Android面试题基础(转)
  7. UVa 1642 (综合) Magical GCD
  8. Cocos2d-x——CocosBuilder官方帮助文档翻译1 使用自定义类
  9. Android源码是这样搞到的(图解)
  10. java 枚举类型
  11. WINDOWS 2012忘记密码之后。。。
  12. json 去空值与缩进
  13. 【centos6 , 6】linux 查看帮助文档:
  14. web.xml组件加载顺序
  15. SourceTree 实现 git flow 流程
  16. Spring AOP中的JDK和CGLib动态代理哪个效率更高?
  17. 搭建SpringBoot+dubbo+zookeeper+maven框架(一)
  18. php--------合并2个数字键数组的值
  19. ArchLinux新版本(pacstrap安装)及国内较优源推荐
  20. Volley 源码解析(转)

热门文章

  1. JavaScript学习三
  2. mysql行列转置
  3. 语法错误1:TabError: Inconsistent use of tabs and spaces in indentation
  4. 2015 多校赛 第五场 1006 (hdu 5348)
  5. HDU 4474 Yet Another Multiple Problem BFS
  6. Laravel5.1学习笔记9 系统架构1 请求生命周期 (待修)
  7. 仿QQ空间长图效果简易版--母亲节感恩
  8. 【java基础】(6)内部类
  9. scrollWidth clientWidth offsetWidth
  10. dubbo之线程模型