Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
cy920820 committed Jun 22, 2018
2 parents d90a202 + eff1c6c commit 3d1b12c
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ typings/

# editor
.idea/
# mac
.DS_Store
2 changes: 1 addition & 1 deletion example/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function getIP() {
let interfaces = os.networkInterfaces()
for (let key in interfaces) {
interfaces[key].some(function(details) {
if (details.family == 'IPv4' && key == 'en8') {
if (details.family == 'IPv4' && key == 'en0') {
IPv4 = details.address
return true
}
Expand Down
37 changes: 36 additions & 1 deletion example/src/demos/swipeOut/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default create({
tips: '您的帐号有异常登录,如非本人操作,请及时修改密码',
id: 4
}
]
],

visible: true
}
},
methods: {
Expand All @@ -34,6 +36,39 @@ export default create({
if (index === 1) {
this.lists.splice(index, 1)
}
},

loadmore() {
setTimeout(() => {
if (this.lists > 100) {
this.visible = false
} else {
this.lists.push({
title: '网易更新了',
tips: '不再支持Flash视频播放',
id: 1
},
{
title: '电影新资讯',
tips: '电影《红海行动》上映以来票房暴涨,很多国人表示对国产电影有了新的改观',
id: 2
},
{
title: '聚焦两会·共筑中国梦',
tips: '习近平代表的两会故事',
id: 3
},
{
title: '微信团队',
tips: '您的帐号有异常登录,如非本人操作,请及时修改密码',
id: 4
})
}
}, 500)
}
},

created () {
this.loadmore()
}
})
2 changes: 2 additions & 0 deletions example/src/demos/swipeOut/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
</div>
</SwipeOutItem>
</SwipeOut>

<Loadmore @reachBottom="loadmore" :visible="visible" desc="正在加载..."></Loadmore>
</div>
8 changes: 6 additions & 2 deletions lib/baobab-ui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/baobab-ui.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/baobab-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/baobab-ui.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "baobab-ui",
"version": "1.0.10",
"version": "1.0.12",
"description": "BBT内部组件库-基于vue2.0的UI组件库",
"main": "lib/baobab-ui.js",
"directories": {
Expand Down
10 changes: 7 additions & 3 deletions src/Radio/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
border: 1px solid transparent;
}

.baobab-radio-icon--normal.disabled {
.Radio--icon-normal i {
transform: rotate(-45deg) scale(0);
}

.Radio--icon-normal.disabled {
background-color: #ccc;
}

Expand All @@ -64,10 +68,10 @@
border-bottom: 1px solid #fff;
border-left: 1px solid #fff;
transform: rotate(-45deg) scale(1);
transition transform .2s;
transition: transform .2s;
}

.baobab-radio-icon--check i {
.Radio--icon-check i {
transform: rotate(-45deg) scale(0);
}

Expand Down
28 changes: 22 additions & 6 deletions src/SwipeOut/SwipeOutItem/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import create from './index.tpl'
import './index.styl'

function preDefault(e) {
if (e.cancelable) {
// 判断默认行为是否已经被禁用
if (!e.defaultPrevented) {
e.preventDefault()
}
}
}

const component = create({
name: 'SwipeOutItem',

Expand All @@ -10,15 +19,16 @@ const component = create({
translate: 0,
startX: 0,
oldTouches: null,
btnWidth: 0
btnWidth: 0,
moveX: 0
}
},

computed: {
itemStyle() {
return {
transition: `all ${this.speed}ms`,
transform: `translate3d(${this.translate}px, 0, 0)`
transition: `all ${this.speed}ms ease`,
transform: `translateX(${this.translate}px)`
}
}
},
Expand All @@ -36,9 +46,9 @@ const component = create({

move(e) {
let moveX = e.touches[0].pageX - this.oldTouches.pageX
this.moveX = moveX
let moveY = e.touches[0].pageY - this.oldTouches.pageY

if (Math.abs(moveX) < Math.abs(moveY) || Math.abs(moveX) < 20 || Math.abs(moveY) > 30) return
if (Math.abs(moveX) < Math.abs(moveY) || Math.abs(moveX) < 20 || Math.abs(moveY) > 5) return
e.preventDefault()
this.$parent.$emit('resetItem', this)
moveX = this.startX * 1 + moveX * 1
Expand All @@ -49,15 +59,21 @@ const component = create({
} else if (moveX > 0) {
moveX = 0
}
document.addEventListener('touchmove', preDefault, { passive: false })
this.translate = moveX
},

end() {
// 自动布置
let moveX = -this.translate > 30 ? -this.btnWidth : 0
let moveX = -this.translate > 20 ? -this.btnWidth : 0
if (this.moveX > 0) {
moveX = 0
}

// 滑动停止之前将speed置为0
this.speed = 300
this.translate = moveX
document.removeEventListener('touchmove', preDefault, { passive: false })
},

close() {
Expand Down

0 comments on commit 3d1b12c

Please sign in to comment.