vue/cli - (1) 开始

// 安装最新vue/cli
npm i -g @vue/cli

// 安装指定版本
npm i -g @vue/[email protected]
// cd 项目位置
// apps 项目名, 不能含大写字母
vue create apps

// 默认带有git, 若项目中不需要
vue create apps -n
// 方向键上下选择
Please pick a preset:
	Manually select features

// 空格为选中, 回车下一步
Babel, Router, CSS.. (后续可通过"vue add cli-plugin-eslint"添加其它)

Use history mode for router?
	// n, router配置不会有"mode"和"base", 但链接后带"#/"
	// y, 链接后不带"#/", 但router后URL异常
		// 可删除router配置(../router/index.js)的"mode: 'history',"

Pick a CSS pre-processor
	// Sass/SCSS (with dart-sass)

Where do you prefer placing..
	// In package.json

Save this as a preset..
	// n

 

  • 运行

更多定制 vue/cli - (2) vue.config.js

npm run serve
    http://localhost:8080

 

  • 相关版本
node -v
	v12.16.1

npm -v
	6.13.4

vue -V
	@vue/cli 4.2.3

 

  • .gitignore
node_modules

/vue.config.js
/package.json
/.*

忽略已经加入版本控制的文件, 如 vue.config.js

git update-index --assume-unchanged vue.config.js

重新加入版本控制

git update-index --no-assume-unchanged vue.config.js

 

  • 文献

https://cli.vuejs.org/zh/guide

https://router.vuejs.org/zh/guide/essentials/history-mode.htm

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章