一、vue3 安装
# 如果已经全局安装了旧版本的vue-cli(1.x 或 2.x),需要先卸载
npm uninstall vue-cli -g
# 安装淘宝镜像
npm install -g cnpm --registry=https://registry.npm.taobao.org
# 安装/升级脚手架
npm install -g @vue/cli
# vue自定义安装教程
https://www.cnblogs.com/qingheshiguang/p/14595806.html
# 查看vue版本
vue -V
二、第一个vue3项目
# vue初始化
npm create hello-vue3
# 安装依赖
npm install
# 集成element组件
npm install element-plus --save
# 查看路由版本号
npm info vue-router versions
# 集成特定版本的路由,默认则是最新版本
npm install vue-router@4.0.0-beta.10 --save-dev
# 安装 SASS 加载器
npm install sass-loader node-sass --save-dev
# 安装 异步请求Axios
npm install --save axios vue-axios
# 安装echart图表插件
npm install --save echarts
三、vue启动/打包
# Compiles and hot-reloads for development
npm run serve
# Compiles and minifies for production
npm run build
# Lints and fixes files
npm run lint
四、修改端口号
# 在package.json中,添加--port 999
"scripts": {
"serve": "vue-cli-service serve --port 9999",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
网友评论