通过vue-cli构建vue项目
vue init webpack vue-music
会出现以下的配置选项
Project name vue-music //项目名称
? Project description vue组件化开发音乐播放器 //项目描述
? Author hyj //作者
? Vue build runtime //这里选第二个,使用vue文件写项目
1.Runtime + Compiler: recommended for most users
2.Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required el
sewhere
? Install vue-router? Yes //是否使用vue-router
? Use ESLint to lint your code? Yes //是否使用ESLint
? Pick an ESLint preset Standard //使用ESLint的那种模式
? Set up unit tests No //是否使用测试
? Setup e2e tests with Nightwatch? No //是否使用测试
? Should we run `npm install` for you after the project has been created? (recommended) npm //使用哪种包管理工具
如果是版本比较地的vue-cli,这里就需要自己手动安装依赖,如果版本较高的话,会自动安装依赖包省去了npm install
cd vue-music
npm install
npm run dev
npm run dev打开
localhost:8080