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

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


 

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

打包并压缩 npm run build

3.x版本

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)

新建组件、路由、模块、服务请参考:https://www.cnblogs.com/mary-123/p/10484648.html  和 https://www.cnblogs.com/mary-123/p/10566461.html

新建组件 ng g c name //组件名称(单路由模块情况)

ng g c home --module=app即在 app.module.ts中生成  ng g c home --module=router/app-routing  //router当前路由模块文件夹  app-routing路由文件名称,(多路由模块情况下,app.module和app-routing中都有路由)

新建模块 ng generate module [模块统一存放文件夹]/name

新建服务 ng generate service [服务统一存放文件夹]/name //name服务名称

创建路由守卫 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 压缩

 

posted @ 2019-07-25 09:39  一城柳絮吹成雪  阅读(404)  评论(0编辑  收藏  举报