码迷,mamicode.com
首页 > 其他好文 > 详细

ECMASCript2015 提案 stage-3的对象展开运算符

时间:2016-12-23 19:20:39      阅读:993      评论:0      收藏:0      [点我收藏+]

标签:color   methods   method   github   res   object   one   使用   nbsp   

  看源码时看到如下的代码

export default {

    //通过mapActions将actions映射到methods里

    methods: {
        ...mapActions([
            ‘updateStatus‘,
            ‘reset‘
        ])
    },

    created: function() {
        this.updateStatus(STATUS.READY);
        this.reset();
    },

    components: {Dashboard, Chessboard, Status}
}

  

...mapActions 是什么鬼, 不记得ES6里有这么用展开运算符的。后来查了下资料,发现是stage-3的对象展开运算符,目前chrome和火狐都不支持,使用方法在githubbabelmapState 函数返回的是一个对象,

然后对返回的对象使用展开运算符。

ECMASCript2015 提案 stage-3的对象展开运算符

标签:color   methods   method   github   res   object   one   使用   nbsp   

原文地址:http://www.cnblogs.com/zhansu/p/6215604.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!