近期高频-vuecli3-vue2

292 阅读1分钟

安装vue cli3 1、首先卸载旧版本(如果事先安装了vue cli1.x或者vue cli2.x,要先卸载掉) npm uninstall vue-cli -g

2、node版本要要求 You are using Node v6.11.0, but this version of vue-cli requires Node >=8.9.

You are using Node v8.9.3. Node.js 8.x has already reached end-of-life and will not be supported in future major releases. It's strongly recommended to use an active LTS version instead. @vue/cli 4.5.6

juejin.cn/post/684490… 3,在项目中优雅的使用svg

4.axios封装api、模块化vuex

5.全局loading、合理利用vue router守卫

6**.**常用的utils 到现在为止,utils/目录下应该有auth.js 、permission.js、request.js;

那么对与一些常用的方法,你可以放到utils/common.js 里,统一install到vue 实例上,并通过Vue.use()使用;

对于一些全局的过滤器,你仍可以放到utils/filters.js里,使用Vue.fileter()注册到全局;

对于一些全局方法,又不是很长用到的,可以放到utils/index.js,哪里使用哪里import

7.mixin减少项目冗余代码

vue3.0 juejin.cn/post/687523…