Home >Web Front-end >Vue.js >Why does vue.js report an error?
vue.js reports an error because the project does not recognize the es6 expansion operator. The solution is to download the es6 dependencies through the "cnpm install babel-preset-es2015 --save-dev" method.
#The operating environment of this article: Windows7 system, vue2.0, Dell G3 computer.
Why does using the... operator in vue.js report an error?
vue.js reports an error when using the... operator: the project does not recognize the es6 expansion operator. The solution is very simple.
Solution:
// 第一步 cnpm install babel-plugin-transform-object-rest-spread // 第二步 看一下你的 .babelrc 里面是否有识别es6语法的配置 { "presets": [ ["env", { "modules": false, "targets": { "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] } }], "stage-2" ], "presets": [ ["es2015", { "modules": false }] ], "plugins": ["transform-object-rest-spread"] }
After doing both, I found that another error was reported. The reason is that you only configured it. But there is no download of es6 dependencies
Just need to download
cnpm install babel-preset-es2015 --save-dev
and it will be ok!
Recommended: "vuejs tutorial"
The above is the detailed content of Why does vue.js report an error?. For more information, please follow other related articles on the PHP Chinese website!