vue项目创建,cnpm下载

cnpm下载


- 安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

Vue-CLI项目搭建

环境搭建


- 安装node

官网下载安装包,傻瓜式安装:https://nodejs.org/zh-cn/

- 安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

- 安装脚手架

cnpm install -g @vue/cli


- 清空缓存处理

npm cache clean --force

项目的创建


vue create 项目名
// 要提前进入目标目录(项目应该创建在哪个目录下)
// 选择自定义方式创建项目,选取Router, Vuex插件
//标准eslint,自动修复(ESlint+Standard config--》lint on save+Lint and fix on commit)
vue ui 使用图形界面创建项目

启动/停止项目


npm run serve / ctrl+c
        启动    停止
// 要提前进入项目根目录

打包项目


npm run build
// 要在项目根目录下进行打包操作

package.json中


"scripts": {
    "serve": "vue-cli-service serve",  # 运行项目
    "build": "vue-cli-service build",  # 编译项目成html,css,js
    "lint": "vue-cli-service lint"     # 代码格式化
},

posted @ 2022-07-06 16:06  春游去动物园  阅读(1015)  评论(0编辑  收藏  举报