Skip to content

Commit 08a1ce7

Browse files
committed
fix: swipeAction 动画 ,loadMore 动画速度,collapse 在低版本没有动画的bug,
1 parent f93c591 commit 08a1ce7

8 files changed

Lines changed: 48 additions & 46 deletions

File tree

‎components/uni-collapse-item/uni-collapse-item.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</view>
1313
</view>
1414
<view :style="{ height: isOpen ? 'auto' : '0px' }" class="uni-collapse-cell__content">
15-
<view :class="{ 'uni-collapse-cell--animation': showAnimation === true }" :style="{ transform: isOpen ? 'translateY(0px)' : 'translateY(-50%)' }">
15+
<view :class="{ 'uni-collapse-cell--animation': showAnimation === true }" :style="{ transform: isOpen ? 'translateY(0px)' : 'translateY(-50%)','-webkit-transform' : isOpen ? 'translateY(0px)' : 'translateY(-50%)' }">
1616
<slot />
1717
</view>
1818
</view>

‎components/uni-fab/uni-fab.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
},
126126
watch: {
127127
pattern(newValue, oldValue) {
128-
console.log(JSON.stringify(newValue))
128+
//console.log(JSON.stringify(newValue))
129129
this.styles = Object.assign({}, this.styles, newValue)
130130
}
131131
},

‎components/uni-load-more/uni-load-more.vue‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<view class="uni-load-more">
3-
<view v-if="platform === 'android'" v-show="status === 'loading' && showIcon" class="uni-load-more__img">
3+
<view v-if="iconType==='circle' || iconType==='auto' && platform === 'android'" v-show="status === 'loading' && showIcon" class="uni-load-more__img">
44
<view :style="{borderColor : color}" class="loader-android" />
55
</view>
66
<view v-else v-show="status === 'loading' && showIcon" class="uni-load-more__img">
@@ -43,6 +43,10 @@
4343
type: Boolean,
4444
default: true
4545
},
46+
iconType: {
47+
type: String,
48+
default: 'auto'
49+
},
4650
color: {
4751
type: String,
4852
default: '#777777'
@@ -138,7 +142,7 @@
138142
border: solid 2px #777;
139143
border-radius: 50%;
140144
border-bottom-color: transparent !important;
141-
animation: loader-android 2s 0s linear infinite
145+
animation: loader-android 1s 0s linear infinite
142146
}
143147
144148
.load1,

‎components/uni-search-bar/uni-search-bar.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<view :style="{borderRadius:radius+'rpx'}" class="uni-searchbar-form__box">
55
<uni-icons :color="'#999999'" class="icon-search" type="search" size="18" />
66
<input :placeholder="placeholder" :focus="show" v-model="searchVal" class="search-input" type="text" placeholder-style="color:#cccccc" confirm-type="search" @confirm="confirm">
7-
<uni-icons :color="'#999999'" v-if="clearButton==='always'||clearButton==='auto'&&searchVal!==''" class="icon-clear" type="clear" size="14" @click="clear" />
7+
<uni-icons :color="'#999999'" v-if="clearButton==='always'||clearButton==='auto'&&searchVal!==''" class="icon-clear" type="clear" size="24" @click="clear" />
88
</view>
99
<view :style="{borderRadius:radius+'rpx'}" class="uni-searchbar-form__text" @click="searchClick">
1010
<uni-icons color="#999999" class="icon-search" type="search" size="18" />

‎components/uni-swipe-action/index.wxs‎

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
function change(newValue, oldValue, ownerInstance, instance) {
2-
var state = instance.getState()
3-
console.log('----');
2+
var state = instance.getState()
43
state.position = JSON.parse(instance.getDataset().position)
54
if (state.position.length === 0) return
6-
if (state.isMove) return
5+
// if (state.isMove) return
76
var show = state.position[0].show
87
state.left = state.left || state.position[0].left;
98
if (show) {
@@ -14,10 +13,14 @@ function change(newValue, oldValue, ownerInstance, instance) {
1413
}
1514

1615
function touchstart(e, ins) {
17-
var instance = e.instance;
18-
console.log(instance.getState());
16+
var instance = e.instance;
1917
var state = instance.getState();
2018
var pageX = e.touches[0].pageX;
19+
instance.removeClass('ani');
20+
var owner = ins.selectAllComponents('.button-hock')
21+
for (var i = 0; i < owner.length; i++) {
22+
owner[i].removeClass('ani');
23+
}
2124
state.position = JSON.parse(instance.getDataset().position);
2225
state.left = state.left || state.position[0].left;
2326
state.width = pageX - state.left;
@@ -30,7 +33,7 @@ function touchmove(e, ownerInstance) {
3033
var state = instance.getState()
3134
if (disabled) return
3235
if (state.isMove) return
33-
var pageX = e.touches[0].pageX;
36+
var pageX = e.touches[0].pageX;
3437
setValue(pageX - state.width, instance, ownerInstance)
3538

3639
}
@@ -49,8 +52,9 @@ function setValue(value, instance, ownerInstance) {
4952
var x = Math.max(-state.position[1].width, Math.min((value), 0));
5053
state.left = x;
5154
instance.setStyle({
52-
transform: 'translateX(' + x + 'px)'
53-
})
55+
transform: 'translateX(' + x + 'px)',
56+
'-webkit-transform': 'translateX(' + x + 'px)'
57+
})
5458
setFold(x, instance, ownerInstance)
5559
}
5660

@@ -84,15 +88,16 @@ function setFold(value, instance, ownerInstance) {
8488
var position = state.position;
8589
var arr = [];
8690
var w = 0;
87-
for (var i = 0; i < ins.length; i++) {
88-
if(!ins[i].getDataset().button) return
91+
for (var i = 0; i < ins.length; i++) {
92+
if (!ins[i].getDataset().button) return
8993
var btnData = JSON.parse(ins[i].getDataset().button)
90-
var button = btnData[i] && btnData[i].width || 0
94+
var button = btnData[i] && btnData[i].width || 0
9195
w += button
9296
arr.push(-w)
9397
if (i != 0) {
9498
ins[i].setStyle({
95-
transform: 'translateX(' + (arr[i - 1] + value * (arr[i - 1] / position[1].width)) + 'px)'
99+
transform: 'translateX(' + (arr[i - 1] + value * (arr[i - 1] / position[1].width)) + 'px)',
100+
'-webkit-transform': 'translateX(' + (arr[i - 1] + value * (arr[i - 1] / position[1].width)) + 'px)'
96101
})
97102
}
98103
}
@@ -107,20 +112,15 @@ function open(ins, ownerInstance) {
107112
ownerInstance.callMethod('change', {
108113
open: true
109114
})
110-
111-
function animate() {
112-
var step = (position[1].width + state.left) / 4;
113-
step = step > 1 ? step : 2;
114-
state.left -= step
115-
setValue(state.left, ins, ownerInstance)
116-
if (state.left <= -position[1].width) {
117-
setValue(-position[1].width, ins, ownerInstance)
118-
state.isMove = false
119-
return
120-
}
121-
ins.requestAnimationFrame(animate)
122-
}
123-
animate()
115+
ins.addClass('ani');
116+
var owner = ownerInstance.selectAllComponents('.button-hock')
117+
for (var i = 0; i < owner.length; i++) {
118+
owner[i].addClass('ani');
119+
}
120+
121+
state.isMove = false
122+
setValue(-position[1].width, ins, ownerInstance)
123+
setFold(-position[1].width,ins, ownerInstance)
124124
}
125125

126126
function close(ins, ownerInstance) {
@@ -132,20 +132,13 @@ function close(ins, ownerInstance) {
132132
open: false
133133
})
134134

135-
function animate() {
136-
var step = (-state.left) / 4;
137-
step = step > 0.1 ? step : 0.5;
138-
state.left += step
139-
setValue(state.left, ins, ownerInstance)
140-
if (state.left >= 0) {
141-
142-
setValue(0, ins, ownerInstance)
143-
state.isMove = false
144-
return
145-
}
146-
ins.requestAnimationFrame(animate)
135+
ins.addClass('ani');
136+
var owner = ownerInstance.selectAllComponents('.button-hock')
137+
for (var i = 0; i < owner.length; i++) {
138+
owner[i].addClass('ani');
147139
}
148-
animate()
140+
setValue(0, ins, ownerInstance)
141+
state.isMove = false
149142
}
150143

151144

‎pages/extUI/collapse/collapse.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
},
162162
methods: {
163163
change(e) {
164-
console.log(e)
164+
//console.log(e)
165165
}
166166
}
167167
}

‎pages/extUI/fav/fav.vue‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
},
3333
data() {
3434
return {
35-
check_1: false,
3635
checkList: [false, false, false, false, false, false],
3736
contentText: {
3837
contentDefault: '追番',

‎pages/extUI/load-more/load-more.vue‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
<view class="example-body">
1010
<uni-load-more :status="status" :content-text="contentText" color="#007aff" />
1111
</view>
12+
<view class="example-title">指定加载图标样式</view>
13+
<view class="example-body">
14+
<uni-load-more iconType="circle" :status="status" />
15+
<uni-load-more iconType="auto" :status="status" />
16+
<uni-load-more iconType="spinner" :status="status" />
17+
</view>
1218

1319
<view class="example-title">改变组件状态</view>
1420
<radio-group class="uni-list" @change="onChange">

0 commit comments

Comments
 (0)