React、Vue、Angular對比 ---- 新建及打包

react:
npm install -g create-react-app
create-react-app react-project
npm install
npm run startcss


 

vue:
npm install vue-cli -g
vue init webpack my-project
npm install
npm run devhtml

打包並壓縮 npm run buildvue

3.x版本react

npm install -g @vue/cli
# 新建項目
vue create my-project
# 項目啓動
npm run serve
# 打包
npm run build

 

angular:
npm install -g typescript
npm install -g @angular/cli
ng new my-project  詳解: ng g c name --style less/sass/scss  設置項目css基於less/sass/scss
npm install
npm start (ng serve)webpack

新建組件、路由、模塊、服務請參考:http://www.javashuo.com/article/p-ysmalacv-dk.html  和 http://www.javashuo.com/article/p-xeruhhdb-cz.htmlweb

新建組件 ng g c name //組件名稱(單路由模塊狀況)vue-cli

ng g c home --module=app即在 app.module.ts中生成  ng g c home --module=router/app-routing  //router當前路由模塊文件夾  app-routing路由文件名稱,(多路由模塊狀況下,app.module和app-routing中都有路由)typescript

新建模塊 ng generate module [模塊統一存放文件夾]/namenpm

新建服務 ng generate service [服務統一存放文件夾]/name //name服務名稱sass

建立路由守衛 ng generate guard auth/auth

新建路由組件:ng generate module router/app-routing --flat --module=app  路由名稱app-routing  router文件夾名稱

打包:ng build --base-href=/platform/steam

打包並壓縮:ng build --base-href=/platform/steam --prod

base-href= 後面表示打包加的文件夾路徑  --prod 壓縮

相關文章
相關標籤/搜索