|
@@ -1,6 +1,6 @@
|
1
|
1
|
<template>
|
2
|
2
|
<div class="yo-scroll" :class="{'down':(state===0),'up':(state==1),refresh:(state===2),touch:touching}" @touchstart="touchStart($event)" @touchmove="touchMove($event)" @touchend="touchEnd($event)">
|
3
|
|
- <section class="inner">
|
|
3
|
+ <section class="inner" :style="{ transform: 'translate3d(0, 0px, 0)' }">
|
4
|
4
|
<header class="pull-refresh">
|
5
|
5
|
<slot name="pull-refresh">
|
6
|
6
|
<span class="down-tip">下拉更新</span>
|
|
@@ -30,7 +30,7 @@ export default {
|
30
|
30
|
},
|
31
|
31
|
enableInfinite: { // 上拉加载
|
32
|
32
|
type: Boolean,
|
33
|
|
- default: false
|
|
33
|
+ default: true
|
34
|
34
|
},
|
35
|
35
|
enableRefresh: { // 下拉刷新
|
36
|
36
|
type: Boolean,
|
|
@@ -76,7 +76,7 @@ export default {
|
76
|
76
|
this.$el.querySelector('.load-more').style.display = 'block'
|
77
|
77
|
},
|
78
|
78
|
touchMove (e) {
|
79
|
|
- if (this.dataList.noFlag || !this.touching) {
|
|
79
|
+ if (!this.enableRefresh || this.dataList.noFlag || !this.touching) {
|
80
|
80
|
return
|
81
|
81
|
}
|
82
|
82
|
let diff = e.targetTouches[0].pageY - this.startY - this.startScroll
|
|
@@ -85,7 +85,6 @@ export default {
|
85
|
85
|
if (this.state === 2) { // in refreshing
|
86
|
86
|
return
|
87
|
87
|
}
|
88
|
|
- console.log(123)
|
89
|
88
|
if (this.top >= this.offset) {
|
90
|
89
|
this.state = 1
|
91
|
90
|
} else {
|
|
@@ -100,9 +99,9 @@ export default {
|
100
|
99
|
}
|
101
|
100
|
},
|
102
|
101
|
touchEnd (e) {
|
103
|
|
- // if (!this.enableRefresh) {
|
104
|
|
- // return
|
105
|
|
- // }
|
|
102
|
+ if (!this.enableRefresh) {
|
|
103
|
+ return
|
|
104
|
+ }
|
106
|
105
|
this.touching = false
|
107
|
106
|
if (this.state === 2) { // in refreshing
|
108
|
107
|
this.state = 2
|