使用vue-cli

mac2022-06-30  24

 

准备工作: node + npm + vue-cli

确保node安装成功

1、终端查询一下 node -v

2、使用命令全局安装vue-cli

  npm install -g vue-cli  

3、使用命令创建项目

   vue init webpack basics(项目名称)

$ vue init webpack projectName -- 安装vue-cli,初始化vue项目命令? Target directory exists. Continue? (Y/n) y ------找到了projectName这个目录是否要继续? Target directory exists. Continue? Yes? Project name (projectName)---------------------项目的名称(默认是文件夹的名称),ps:项目的名称不能有大写,不能有中文,否则会报错? Project name projectName? Project description (A Vue.js project)---------------------项目描述,可以自己写? Project description A Vue.js project? Author (king)---------------------项目创建者? Author king? Vue build (Use arrow keys)--------------------选择打包方式,有两种方式(runtime和standalone),使用默认即可? Vue build standalone? Install vue-router? (Y/n) y--------------------是否安装路由,一般都要安装? Install vue-router? Yes? Use ESLint to lint your code? (Y/n) n---------------------是否启用eslint检测规则,这里个人建议选no,因为经常会各种代码报错,新手还是不安装好? Use ESLint to lint your code? No? Setup unit tests with Karma + Mocha? (Y/n)--------------------是否安装单元测试? Setup unit tests with Karma + Mocha? Yes? Setup e2e tests with Nightwatch? (Y/n) y)--------------------是否安装e2e测试 ? Setup e2e tests with Nightwatch? Yes

 创建完成

 使用命令 npm run dev运行

文件目录

 

转载于:https://www.cnblogs.com/king94Boy/p/10760661.html

最新回复(0)