Parcourir la source

Merge branch 'new_pad_branch' of http://git.shengws.com/zhangbj/xt_pad into new_pad_branch

xiaoming_global il y a 5 ans
Parent
révision
8db629b33f
3 fichiers modifiés avec 11817 ajouts et 14277 suppressions
  1. 11782 14257
      package-lock.json
  2. 1 0
      package.json
  3. 34 20
      src/App.vue

Fichier diff supprimé car celui-ci est trop grand
+ 11782 - 14257
package-lock.json


+ 1 - 0
package.json Voir le fichier

18
   },
18
   },
19
   "dependencies": {
19
   "dependencies": {
20
     "axios": "^0.19.0",
20
     "axios": "^0.19.0",
21
+    "better-scroll": "^1.15.2",
21
     "cropperjs": "^1.4.3",
22
     "cropperjs": "^1.4.3",
22
     "element-ui": "^2.9.1",
23
     "element-ui": "^2.9.1",
23
     "lib-flexible": "^0.3.2",
24
     "lib-flexible": "^0.3.2",

+ 34 - 20
src/App.vue Voir le fichier

1
 <template>
1
 <template>
2
-  <div id="app">
2
+  <div id="app" ref="wrapper">
3
     <!-- <img src="./assets/logo.png"> -->
3
     <!-- <img src="./assets/logo.png"> -->
4
-    <router-view  v-if="isRouterAlive" />
4
+    <router-view v-if="isRouterAlive" />
5
   </div>
5
   </div>
6
 </template>
6
 </template>
7
 
7
 
8
 <script>
8
 <script>
9
+import BScroll from "better-scroll";
9
 export default {
10
 export default {
10
-  name: 'App',
11
-  provide () {
11
+  name: "App",
12
+  provide() {
12
     return {
13
     return {
13
       reload: this.reload
14
       reload: this.reload
14
-    }
15
+    };
15
   },
16
   },
16
-  data () {
17
+  data() {
17
     return {
18
     return {
18
       isRouterAlive: true
19
       isRouterAlive: true
19
-    }
20
+    };
20
   },
21
   },
21
   methods: {
22
   methods: {
22
-    reload () {
23
-      this.isRouterAlive = false
24
-      this.$nextTick(function () {
25
-        this.isRouterAlive = true
26
-      })
23
+    reload() {
24
+      this.isRouterAlive = false;
25
+      this.$nextTick(function() {
26
+        this.isRouterAlive = true;
27
+      });
27
     }
28
     }
28
   },
29
   },
29
   watch: {
30
   watch: {
30
-    '$route': function (to, from) {
31
-      document.body.scrollTop = 0
32
-      document.documentElement.scrollTop = 0
31
+    $route: function(to, from) {
32
+      document.body.scrollTop = 0;
33
+      document.documentElement.scrollTop = 0;
33
     }
34
     }
35
+  },
36
+  mounted() {
37
+    this.$nextTick(() => {
38
+      //$refs绑定元素
39
+      if (!this.scroll) {
40
+        this.scroll = new BScroll(this.$refs.wrapper, {
41
+          //开启点击事件 默认为false
42
+          click: true
43
+        });
44
+        // console.log(this.scroll)
45
+      } else if (!this.$refs.wrapper) {
46
+        return;
47
+      } else {
48
+        this.scroll.refresh();
49
+      }
50
+    });
34
   }
51
   }
35
-
36
-}
52
+};
37
 </script>
53
 </script>
38
 
54
 
39
-<style>
40
-
41
-</style>
55
+<style></style>