A Vue.js project
基于vue-cli命令:vue init webpack [project_name]构建的项目,新加的功能:
- vue-resource(添加全局拦截器interceptors)
- vuex
- vuex-router-sync
- vue-progressbar
- normalize.css
- element-ui
- vue-router(添加按需加载的3种方式、全局路由控制beforeEach、scrollBehavior)
- 将数据保存在store中,然后在组件中取store里state的值。
- 返回一个promise,在组件中操作这个promise。
第一种方式适合只要求取接口值的情况。
第二种方式适合对返回的数据再做一些处理的情况,灵活性高。
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
For detailed explanation on how things work, checkout the guide and docs for vue-loader.