vue-cli 新建模板项目---vue-cli
生活随笔
收集整理的這篇文章主要介紹了
vue-cli 新建模板项目---vue-cli
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
首先要安裝好node.js,然后才可以用vue。
設置淘寶鏡像:大家都知道國內直接使用 npm 的官方鏡像是非常慢的,這里推薦使用淘寶 NPM 鏡像。
?
npm install-g cnpm --registry=https://registry.npm.taobao.org
這樣就可以使用 cnpm 命令來安裝模塊了:?cnpm install[name]
?
安裝webpack?
cnpm install webpack-g
安裝vue腳手架
npm install vue-cli-g
在硬盤上找一個文件夾放工程用的,在終端中進入該目錄
然后就可以創建vue項目了環境要求: ?安裝有?Node.js、?vue、?vue-cli?
cd目錄路徑
?
步驟:
- cd 目錄(你要把項目放在哪個目錄);
- vue init webpack pname(你的項目名字);
- ? Project description (A Vue.js project) vue-cli新建項目(項目描述);
- ? Author (xhdx <zhuming3834@sina.com>) ;zhuming3834@sina.com(項目作者);
- ? Vue build?
? Runtime + Compiler: recommended for most users?
Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere?
這里選擇Runtime + Compiler: recommended for most users; - ? Install vue-router? (Y/n) y?是否使用vue-router,這里根據需求選擇;
- ? Use ESLint to lint your code? (Y/n) y?是否使用ESLint,這里根據需求選擇;
- ? Pick an ESLint preset (Use arrow keys)?
? Standard (https://github.com/feross/standard)?
Airbnb (https://github.com/airbnb/javascript) none (configure it yourself)?這里選擇Standard (https://github.com/feross/standard) - ? Setup unit tests with Karma + Mocha? (Y/n) n?是否需要單元測試,這里根據需求選擇;
- Setup e2e tests with Nightwatch? (Y/n) n是否需要單元測試,這里根據需求選擇;
- cd pname(項目目錄);
- npm install?安裝依賴;
- npm run dev?本地運行項目
結果
默認瀏覽器會自動打開http://localhost:8080/#/,出現如下頁面:?
轉載于:https://www.cnblogs.com/Denghejing/p/9202602.html
總結
以上是生活随笔為你收集整理的vue-cli 新建模板项目---vue-cli的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 心情随笔20180620
- 下一篇: python控制窗口缩放