1. Project construction
Install vue-cli 4.5.15 locally and create a project
1.1 Partially install the vue-cli tool to facilitate switching between different versions
###Install the specified version of vue scaffolding tool or already installed, this command is to use vue/cli of version 4.5.15
npm i -D @vue/[email protected]
###View the current vue scaffolding tool version
npx vue -V
1.2 Project creation
① Use commands to create ( npx can be simply understood as partial creation)
npx vue create project-name
②Use the terminal of vscode
▣ Create a nanny tutorial for vue3
▣ Create a nanny tutorial for vue2
③Use Vue Project Manager, use command line input
npx vue ui
The follow-up project of the vue project hoster will pop up, and you can also see the dependencies and modules used, and optimize the startup speed, etc.
2. Project configuration
2.1 Effect: The project is automatically opened, and the project home page pops up automatically after the terminal enters "npm run serve".
Implementation: modify the configuration vue.config.js file as follows
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer:{
open:true,
host:'localhost' //cli脚手架4.5.15后的版本不需要设置host
}
})