仿爱彼迎的Vue
项目
基于 vue2 + webpack + vueRouter
# 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
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
For a detailed explanation on how things work, check out the guide and docs for vue-loader.
- 搭建一个完整的项目骨架
- 使用vw实现移动端适配
- 配置
.postcssrc.js
(参考) - 增加
viewport-units-buggyfill
配置,适配了低版本安卓机型 -
Less
配置 -
svg-sprite-loader
配置(参考) -
vuex
配置 - 添加
normalize.css
(跨浏览器的高度一致性) - 添加
babel-polyfill
(ES6转ES5) - 搭建目录
- apis - 接口
- assets - 静态资源
- components - 组件
- icons - iconfont
- router - 路由
- store - vuex
- styles - 样式
- utils - 工具库
- views - 页面
normalize.css
: 样式重置统一styles/*.less
: 公共样式(UI-Key、工具样式)<style></style>
: 局部样式
- slot插槽分发内容: 向一个组件传递内容
- 父组件给子组件传值:子组件创建
props
接受父组件传递过来的值; 父组件使用子组件的时候,绑定变量传值 - 子组件给父组件传值:父组件使用子组件的时候,绑定监听事件;子组件值发生改变,通过
this.$emit
事件通知父组件 - 子组件不可以直接修改父组件传递过来
props
的变量的值
- 含单个进度条的分页器与图片滚动的时间对不上