yuantianjiao 6 anni fa
parent
commit
5e714b37ab
2 ha cambiato i file con 7 aggiunte e 8 eliminazioni
  1. 6
    7
      src/components/vue-load-more/index.vue
  2. 1
    1
      vue.config.js

+ 6
- 7
src/components/vue-load-more/index.vue Vedi File

@@ -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

+ 1
- 1
vue.config.js Vedi File

@@ -18,6 +18,7 @@ module.exports = {
18 18
   baseUrl: './',
19 19
   // 生产环境是否生成 sourceMap 文件
20 20
   productionSourceMap: true,
21
+  // devtool: 'source-map',
21 22
   chainWebpack: config => config.plugins.delete('named-chunks'),
22 23
   devServer: {
23 24
     proxy: {
@@ -34,7 +35,6 @@ module.exports = {
34 35
       },
35 36
     },
36 37
     // compress: true,
37
-    // devtool: 'source-map',
38 38
     disableHostCheck: true,   // That solved it
39 39
   }
40 40
 }