arms-app 1.0.60 → 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.
- package/package.json +1 -1
- package/view/1.vue +37 -47
package/package.json
CHANGED
package/view/1.vue
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page">
|
|
3
|
-
<h3
|
|
3
|
+
<h3>悬停停自动,手动仍可滚(无缝)</h3>
|
|
4
4
|
|
|
5
5
|
<vue-seamless-scroll
|
|
6
6
|
ref="ss"
|
|
7
7
|
class="warp"
|
|
8
8
|
:data="list"
|
|
9
9
|
:class-option="option"
|
|
10
|
+
@mouseenter.native="hovering = true"
|
|
11
|
+
@mouseleave.native="hovering = false"
|
|
10
12
|
@mousewheel.native.prevent="onWheel"
|
|
11
13
|
@touchstart.native.passive="onTouchStart"
|
|
12
14
|
@touchmove.native.prevent="onTouchMove"
|
|
13
15
|
>
|
|
14
16
|
<div class="list">
|
|
15
|
-
<div
|
|
16
|
-
class="item"
|
|
17
|
-
v-for="(item, index) in list"
|
|
18
|
-
:key="index"
|
|
19
|
-
>
|
|
17
|
+
<div class="item" v-for="(item, index) in list" :key="index">
|
|
20
18
|
{{ item }}
|
|
21
19
|
</div>
|
|
22
20
|
</div>
|
|
@@ -25,69 +23,62 @@
|
|
|
25
23
|
</template>
|
|
26
24
|
|
|
27
25
|
<script>
|
|
28
|
-
import VueSeamlessScroll from
|
|
26
|
+
import VueSeamlessScroll from "vue-seamless-scroll";
|
|
29
27
|
|
|
30
28
|
export default {
|
|
31
|
-
name:
|
|
29
|
+
name: "SeamlessHoverManualView",
|
|
32
30
|
components: {
|
|
33
|
-
VueSeamlessScroll
|
|
31
|
+
VueSeamlessScroll,
|
|
34
32
|
},
|
|
35
33
|
data() {
|
|
36
34
|
return {
|
|
37
35
|
list: [],
|
|
38
|
-
lastTouchY: 0
|
|
39
|
-
|
|
36
|
+
lastTouchY: 0,
|
|
37
|
+
hovering: false,
|
|
38
|
+
autoStep: 0.3,
|
|
39
|
+
};
|
|
40
40
|
},
|
|
41
41
|
computed: {
|
|
42
42
|
option() {
|
|
43
43
|
return {
|
|
44
|
-
step:
|
|
45
|
-
direction: 1,
|
|
46
|
-
hoverStop:
|
|
47
|
-
limitMoveNum: 1,
|
|
48
|
-
openWatch: true
|
|
49
|
-
}
|
|
50
|
-
}
|
|
44
|
+
step: this.hovering ? 0 : this.autoStep,
|
|
45
|
+
direction: 1,
|
|
46
|
+
hoverStop: false,
|
|
47
|
+
limitMoveNum: 1,
|
|
48
|
+
openWatch: true,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
51
|
},
|
|
52
52
|
mounted() {
|
|
53
|
-
|
|
54
|
-
this.list = Array.from({ length: 12 }, (_, i) => `列表项 ${i + 1}`)
|
|
55
|
-
|
|
53
|
+
this.list = Array.from({ length: 15 }, (_, i) => `列表项 ${i + 1}`);
|
|
56
54
|
this.$nextTick(() => {
|
|
57
|
-
this.$refs.ss.reset()
|
|
58
|
-
})
|
|
55
|
+
if (this.$refs.ss && this.$refs.ss.reset) this.$refs.ss.reset();
|
|
56
|
+
});
|
|
59
57
|
},
|
|
60
58
|
methods: {
|
|
61
|
-
// 鼠标滚轮
|
|
62
59
|
onWheel(e) {
|
|
63
|
-
const ss = this.$refs.ss
|
|
64
|
-
if (!ss) return
|
|
60
|
+
const ss = this.$refs.ss;
|
|
61
|
+
if (!ss) return;
|
|
65
62
|
|
|
66
|
-
ss.yPos -= e.deltaY
|
|
63
|
+
ss.yPos -= e.deltaY;
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
if (ss.yPos > 0) ss.yPos = 0
|
|
65
|
+
if (ss.yPos > 0) ss.yPos = 0;
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
ss.yPos = 0
|
|
67
|
+
if (ss.realBoxHeight && Math.abs(ss.yPos) > ss.realBoxHeight / 2) {
|
|
68
|
+
ss.yPos = 0;
|
|
74
69
|
}
|
|
75
70
|
},
|
|
76
|
-
|
|
77
|
-
// 触摸开始
|
|
78
71
|
onTouchStart(e) {
|
|
79
|
-
this.lastTouchY = e.touches[0].clientY
|
|
72
|
+
this.lastTouchY = e.touches[0].clientY;
|
|
80
73
|
},
|
|
81
|
-
|
|
82
|
-
// 触摸移动
|
|
83
74
|
onTouchMove(e) {
|
|
84
|
-
const y = e.touches[0].clientY
|
|
85
|
-
const delta = this.lastTouchY - y
|
|
86
|
-
this.lastTouchY = y
|
|
87
|
-
this.onWheel({ deltaY: delta })
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
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
|
+
};
|
|
91
82
|
</script>
|
|
92
83
|
|
|
93
84
|
<style scoped>
|
|
@@ -96,7 +87,6 @@ export default {
|
|
|
96
87
|
font-family: Arial, Helvetica, sans-serif;
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
/* 外层容器必须固定高度 + hidden */
|
|
100
90
|
.warp {
|
|
101
91
|
height: 260px;
|
|
102
92
|
overflow: hidden;
|
|
@@ -104,7 +94,6 @@ export default {
|
|
|
104
94
|
border-radius: 4px;
|
|
105
95
|
}
|
|
106
96
|
|
|
107
|
-
/* 列表内容 */
|
|
108
97
|
.list {
|
|
109
98
|
padding: 0 12px;
|
|
110
99
|
}
|
|
@@ -115,4 +104,5 @@ export default {
|
|
|
115
104
|
border-bottom: 1px dashed #ddd;
|
|
116
105
|
box-sizing: border-box;
|
|
117
106
|
}
|
|
118
|
-
</style>
|
|
107
|
+
</style>
|
|
108
|
+
|