arms-app 1.0.61 → 1.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/view/1.vue +30 -41
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arms-app",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "一个基于 Express 的 Web 应用1",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/view/1.vue CHANGED
@@ -14,11 +14,7 @@
14
14
  @touchmove.native.prevent="onTouchMove"
15
15
  >
16
16
  <div class="list">
17
- <div
18
- class="item"
19
- v-for="(item, index) in list"
20
- :key="index"
21
- >
17
+ <div class="item" v-for="(item, index) in list" :key="index">
22
18
  {{ item }}
23
19
  </div>
24
20
  </div>
@@ -27,70 +23,62 @@
27
23
  </template>
28
24
 
29
25
  <script>
30
- import VueSeamlessScroll from 'vue-seamless-scroll'
26
+ import VueSeamlessScroll from "vue-seamless-scroll";
31
27
 
32
28
  export default {
33
- name: 'SeamlessHoverManual',
29
+ name: "SeamlessHoverManualView",
34
30
  components: {
35
- VueSeamlessScroll
31
+ VueSeamlessScroll,
36
32
  },
37
33
  data() {
38
34
  return {
39
35
  list: [],
40
36
  lastTouchY: 0,
41
37
  hovering: false,
42
- autoStep: 0.3 // 自动滚动速度
43
- }
38
+ autoStep: 0.3,
39
+ };
44
40
  },
45
41
  computed: {
46
42
  option() {
47
43
  return {
48
- step: this.hovering ? 0 : this.autoStep, // 悬停停自动
44
+ step: this.hovering ? 0 : this.autoStep,
49
45
  direction: 1,
50
- hoverStop: false, // 关闭内置 hoverStop
46
+ hoverStop: false,
51
47
  limitMoveNum: 1,
52
- openWatch: true
53
- }
54
- }
48
+ openWatch: true,
49
+ };
50
+ },
55
51
  },
56
52
  mounted() {
57
- // 模拟数据
58
- this.list = Array.from({ length: 15 }, (_, i) => `列表项 ${i + 1}`)
53
+ this.list = Array.from({ length: 15 }, (_, i) => `列表项 ${i + 1}`);
59
54
  this.$nextTick(() => {
60
- this.$refs.ss.reset()
61
- })
55
+ if (this.$refs.ss && this.$refs.ss.reset) this.$refs.ss.reset();
56
+ });
62
57
  },
63
58
  methods: {
64
- // 鼠标滚轮
65
59
  onWheel(e) {
66
- const ss = this.$refs.ss
67
- if (!ss) return
60
+ const ss = this.$refs.ss;
61
+ if (!ss) return;
68
62
 
69
- ss.yPos -= e.deltaY
63
+ ss.yPos -= e.deltaY;
70
64
 
71
- // 顶部边界
72
- if (ss.yPos > 0) ss.yPos = 0
65
+ if (ss.yPos > 0) ss.yPos = 0;
73
66
 
74
- // 底部回绕(无缝关键)
75
- if (Math.abs(ss.yPos) > ss.realBoxHeight / 2) {
76
- ss.yPos = 0
67
+ if (ss.realBoxHeight && Math.abs(ss.yPos) > ss.realBoxHeight / 2) {
68
+ ss.yPos = 0;
77
69
  }
78
70
  },
79
-
80
- // 触摸开始
81
71
  onTouchStart(e) {
82
- this.lastTouchY = e.touches[0].clientY
72
+ this.lastTouchY = e.touches[0].clientY;
83
73
  },
84
-
85
- // 触摸移动
86
74
  onTouchMove(e) {
87
- const y = e.touches[0].clientY
88
- const delta = this.lastTouchY - y
89
- this.lastTouchY = y
90
- this.onWheel({ deltaY: delta })
91
- }
92
- }
93
- }
75
+ const y = e.touches[0].clientY;
76
+ const delta = this.lastTouchY - y;
77
+ this.lastTouchY = y;
78
+ this.onWheel({ deltaY: delta });
79
+ },
80
+ },
81
+ };
94
82
  </script>
95
83
 
96
84
  <style scoped>
@@ -116,4 +104,5 @@ export default {
116
104
  border-bottom: 1px dashed #ddd;
117
105
  box-sizing: border-box;
118
106
  }
119
- </style>
107
+ </style>
108
+