yuantianjiao 6 年前
父节点
当前提交
5e714b37ab
共有 2 个文件被更改,包括 7 次插入8 次删除
  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 查看文件

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

+ 1
- 1
vue.config.js 查看文件

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