# eleme
**Repository Path**: NightEmperor/eleme
## Basic Information
- **Project Name**: eleme
- **Description**: No description available
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2018-05-26
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
> 本项目是基于vue2最新实战项目,vue2 +vue-router2 + es6 +webpack 高仿饿了么app,是适合新手进阶的绝佳教程。
### header
***
> * 行内元素的留白处理:第一种:父级元素设置font-size:0;第二种:行内标签链接在一起
> * 星级评价:0.5取整
```
itemClasses() {
let result = [];
let score = Math.floor(this.score * 2) / 2;
let hasDecimal = score % 1 !== 0;
let integer = Math.floor(score);
for (let i = 0; i < integer; i++) {
result.push(CLS_ON);
}
if (hasDecimal) {
result.push(CLS_HALF);
}
while (result.length < LENGTH) {
result.push(CLS_OFF);
}
return result;
}
```
> * 弹性盒子的计算:比如弹性盒子内有三个div,中间的盒子width:200px;margin:10px;
400-200-10*6=140px,其余两个div的宽度等分140px;每个div的宽度是70px;
详情页的title就是利用了该原理。
```
.flex-container {
display: -webkit-flex;
display: flex;
width: 400px;
height: 250px;
background-color: lightgrey;
}
.flex-item {
background-color: yellow;
margin: 10px;
}
.item1 {
-webkit-flex: 1;
flex: 1;
}
.item2 {
width:200px;
}
.item3 {
-webkit-flex: 1;
flex: 1;
}
```
> * sticky布局
### goods
> * 小球运动原理:
小球position:fixed;位于购物车,全部隐藏,当点击添加按钮时,触发事件increment,并传递点击事件源,
父级监听后,通过refs执行购物车的drop()函数,小球将显示,因为transition标签包裹,将执行beforeEnter Enter afterEnter
小球抛物线父级做X轴方向运动,小球做Y轴方向运动
```
├── build // 构建服务和webpack配置 ├── config // 项目不同环境的配置 ├── dist // 项目build目录 ├── index.html // 项目入口文件 ├── package.json // 项目配置文件 ├── src // 生产目录 │ ├── assets // 图片资源 │ ├── common // 公共的css js 资源 │ ├── components // 各种组件 │ ├── App.vue // 主页面 │ └── main.js // Webpack 预编译入口