方式一
使用power shell 创建
新建文件夹 ---------- 地址栏输入 powershell
使用cmd 创建
新建文件夹 ---------- 地址栏输入 cmd
vue init webpack demo_name Project name demo_name -------------- 项目名称 Enter Project description (A Vue.js project) -------------- 项目描述 Enter Author 小童 <2207296489@qq.com> ------------- 项目作者 Enter Vue build standalone -------------- 项目模式 Enter Install vue-router? ------------- 安装vue-router Y se ESLint to lint your code? -------------安装eslint 随便,安装后格式总是爆红 N Set up unit tests --------------不懂 N Setup e2e tests with Nightwatch? --------------不懂 N Should we run `npm install` for you after the project has been created? (recommended) > Yes, use NPM Yes, use Yarn No, I will handle that myself cd demo_name -------------- 进入项目目录 ----------------- 运行命令运行项目 tip: 1.用npm后就npm run dev 运行 2.用yarn后用yarn serve运行前需要先运行yarn add serve一下 3.到项目里面自行安装npm install ------ npm install -g yarn
方式二
使用power shell 创建
使用cmd 创建
1.vue create demo_create 2.? Please pick a preset: (Use arrow keys) > Default ([Vue 2] babel, eslint) ------------ 默认vue2 + eslint Default (Vue 3) ([Vue 3] babel, eslint) ------------ 默认vue3 + eslint Manually select features ------------ 手动选择(就这个了) 3. > (*) Choose Vue version ----------- 空格选择这些 ------------Enter (*) Babel ( ) TypeScript ( ) Progressive Web App (PWA) Support (*) Router (*) Vuex (*) CSS Pre-processors (*) Linter / Formatter ( ) Unit Testing ( ) E2E Testing 4.Choose a version of Vue.js that you want to start the project with (Use arrow keys) > 2.x ------------- vue版本,看你需要了 -------- Enter 3.x 5. Use history mode for router? (Requires proper server setup for index fallback in production) (Y/n) --------- 路由模式 是否用history (区分下history 和 hash: history 会次次访问后台接口,hash不会,他自己页面跳转)------ N ------ Enter 6. Sass/SCSS (with dart-sass) Sass/SCSS (with node-sass) Less -------------- 不懂就选 Less -------Enter Stylus 7. ESLint with error prevention only ESLint + Airbnb config ESLint + Standard config -------- 代码校验选项 选这个 -------- Enter ESLint + Prettier 8. Pick additional lint features: (Press <space> to select, <a> to toggle all, <i> to invert selection) ----- 啥时候触发代码校验 --- 随便选,也可都选 >(*) Lint on save (*) Lint and fix on commit 9.Where do you prefer placing config for Babel, ESLint, etc.? (Use arrow keys) --------- 配置类放哪 > In dedicated config files ------- 独立文件 ------选这个 ------- Enter In package.json ------- 写这里一起 10.Save this as a preset for future projects? (y/N) -----是否保存以上的配置--Y 11.Save preset as: vue_demo ------- 取个配置名 12.Pick the package manager to use when installing dependencies: (Use arrow keys) > Use Yarn ---------同上 Use NPM 13.cd demo_create -------- cd 到你创建的目录 14.yarn serve -------- 启动项目
方式三
用可视化工具(cmd 或 powershell)
vue ui就可打开可视化工具,然后自己琢磨