首页 > 其他 > 详细

vuex中的babel编译mapGetters/mapActions报错解决方法

时间:2018-07-09 18:50:35      阅读:1010      评论:0      收藏:0      [点我收藏+]

vex使用...mapActions报错解决办法

技术分享图片

vuex2增加了mapGetters和mapActions的方法,借助stage2的Object Rest Operator

所在通过

methods:{

    ...mapActions([

         ‘increment‘

     ])

}

酱紫去拿到action。但是我们需要安装babel-preset-stage-2的依赖。

 

 

可以使用babel插件, 该插件为

babel-plugin-transform-object-rest-spread

使用方法:

npm install --save-dev babel-plugin-transform-object-rest-spread

新建.babelrc配置文件(切记不要忘记!!!)
{
    "plugins": ["transform-object-rest-spread"]
}
谢谢大家!!!

vuex中的babel编译mapGetters/mapActions报错解决方法

原文:https://www.cnblogs.com/maqingyuan/p/9284916.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!