npm install -g @vue/cli
vue -V 查看版本
npm root -g 查看安装地址
创建脚手架项目
vue create axios-msm 开始创建
-------进入选择
-------Manually select features
-------Babel, Router, CSS Pre-processors, Linter
-------Sass/scss(width dart-sass)
-------Prettier
-------Lint on save
-------In dedicated config files
-------重写项目名
—创建vue.config.js
1、编辑端口号 2、提高打包效率
示例:
module.exports={
devServer :
port : 8888,//端口号
host:“localhost”,//主机 //127.0.0.1
https:false,//协议
open:true,//启动服务自动打开协议
},
lintOnSave:false,//关闭格式检查
productionSourceMap:false,//加快打包速度,不会生成.map的文件
}
npm i -s axios //处理异步请求
npm i -s pubsub-js //非父子之间的通信
npm i -s element-ui //
—main.js
//引入element-ui
import ElementUI from ‘element-ui’;
import ‘element-ui/lib/theme-chalk/index.css’;
//使用element-ui
Vue.use(ElementUI);
//模式:1、开发环境 false 2、大的生产环境 true
Vue.config.productionTip = process.env.NODE_ENV === ‘production’;
console.log(“信息”+Vue.config.productionTip);
—需要安装的插件
Element UI Snippets
Auto Rename Tag
HTML CSS Support
Live Server
Node Snippets
open in browser
Path Intellisense
Path Intellisense
Vetur
Chinese (Simplified) Language Pack for Visual Studio Code