项目是vue-cli自动生成的,所以package.json中已经引入babel也应该可以解析es6语法,可是貌似报错是不能解析...扩展符?
或者是其他什么原因吗?
Add.vue报错部分代码:
import {mapActions, mapMutations} from 'vuex'
export default{
methods: {
save(){
this.saveArticle()
},
...mapActions(['saveArticle']),
...mapMutations(['SET_ARTICLE'])
}
安装依赖如下:
"devDependencies": {
"autoprefixer": "^6.5.3",
"babel-core": "^6.0.0",
"babel-loader": "^6.0.0",
"babel-preset-es2015": "^6.0.0",
"babel-plugin-transform-object-rest-spread": "^6.19.0",
"cross-env": "^3.0.0",
"css-loader": "^0.25.0",
"file-loader": "^0.9.0",
"url-loader": "^0.5.7",
"vue-loader": "^10.0.0",
"vue-resource": "^1.0.3",
"vue-router": "^2.0.1",
"vue-template-compiler": "^2.1.0",
"vuex": "^2.0.0",
"webpack": "^2.1.0-beta.25",
"webpack-dev-server": "^2.1.0-beta.0"
}
控制台报错:
检查你的 .bablerc 里有没有 stage-3 及以下的 preset,正常应该是: