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 压缩

相关文章
相关标签/搜索