vdesign-ui 0.3.0 → 0.3.1
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/README.md +58 -58
- package/dist/components/actionbar/index.js +8 -8
- package/dist/components/actionbar/index.vue +39 -39
- package/dist/components/actionbar/style.less +44 -44
- package/dist/components/actionbar-cell/index.js +7 -7
- package/dist/components/actionbar-cell/index.vue +42 -42
- package/dist/components/actions/index.js +6 -6
- package/dist/components/actions/index.vue +77 -77
- package/dist/components/actions/style.less +109 -109
- package/dist/components/actions-cell/index.js +6 -6
- package/dist/components/actions-cell/index.vue +94 -94
- package/dist/components/actions-cell/style.less +38 -38
- package/dist/components/activityviews/index.js +8 -8
- package/dist/components/activityviews/index.vue +192 -192
- package/dist/components/activityviews/style.less +161 -161
- package/dist/components/badge/index.js +8 -8
- package/dist/components/badge/index.vue +49 -49
- package/dist/components/badge/style.less +54 -54
- package/dist/components/button/index.js +8 -8
- package/dist/components/button/index.vue +93 -93
- package/dist/components/button/style.less +558 -558
- package/dist/components/calendar/index-element.vue +84 -84
- package/dist/components/calendar/index.js +7 -7
- package/dist/components/calendar/index.vue +53 -53
- package/dist/components/calendar/style.less +138 -138
- package/dist/components/checkbox/index.js +8 -8
- package/dist/components/checkbox/index.vue +161 -161
- package/dist/components/checkbox/style.less +288 -288
- package/dist/components/checkbox-group/index.js +7 -7
- package/dist/components/checkbox-group/index.vue +73 -73
- package/dist/components/common/state/index.vue +33 -33
- package/dist/components/common/state/style.less +47 -47
- package/dist/components/data-list/index.js +10 -10
- package/dist/components/data-list/index.vue +19 -19
- package/dist/components/data-list/style.less +623 -623
- package/dist/components/datetime-picker/index.js +7 -7
- package/dist/components/datetime-picker/index.vue +39 -39
- package/dist/components/datetime-picker/style.less +23 -23
- package/dist/components/dialog/index.js +8 -8
- package/dist/components/dialog/index.vue +164 -164
- package/dist/components/dialog/overlay-manager.js +18 -18
- package/dist/components/dialog/style.less +138 -138
- package/dist/components/divider/index.js +8 -8
- package/dist/components/divider/index.vue +54 -54
- package/dist/components/divider/style.less +92 -92
- package/dist/components/dropdown/index.js +8 -8
- package/dist/components/dropdown/index.vue +218 -218
- package/dist/components/dropdown/style.less +432 -432
- package/dist/components/empty/index.js +8 -8
- package/dist/components/empty/index.vue +138 -138
- package/dist/components/empty/style.less +60 -60
- package/dist/components/footer/index.js +6 -6
- package/dist/components/footer/index.vue +33 -33
- package/dist/components/footer/style.less +20 -20
- package/dist/components/footnav/index.js +6 -6
- package/dist/components/footnav/index.vue +93 -93
- package/dist/components/footnav/style.less +22 -22
- package/dist/components/footnav-item/index.js +6 -6
- package/dist/components/footnav-item/index.vue +50 -50
- package/dist/components/footnav-item/style.less +39 -39
- package/dist/components/form/index.js +6 -6
- package/dist/components/form/index.vue +14 -14
- package/dist/components/headnav/index.js +6 -6
- package/dist/components/headnav/index.vue +185 -185
- package/dist/components/headnav/style.less +231 -231
- package/dist/components/icon/font/iconfont.css +163 -163
- package/dist/components/icon/font/iconfont.js +5 -5
- package/dist/components/icon/index.js +9 -9
- package/dist/components/icon/index.vue +96 -96
- package/dist/components/icon/style.less +44 -44
- package/dist/components/input/calcTextareaHeight.js +162 -162
- package/dist/components/input/index.js +8 -8
- package/dist/components/input/index.vue +345 -345
- package/dist/components/input/style.less +471 -471
- package/dist/components/list/index.js +8 -8
- package/dist/components/list/index.vue +152 -152
- package/dist/components/list/style.less +213 -213
- package/dist/components/loading/index.js +6 -6
- package/dist/components/loading/index.vue +68 -68
- package/dist/components/loading/style.less +53 -53
- package/dist/components/mixins/clickoutside.js +81 -81
- package/dist/components/mixins/dom.js +41 -41
- package/dist/components/mixins/languageMixin.js +43 -43
- package/dist/components/mixins/outlineConfigPlugin.js +45 -45
- package/dist/components/mixins/router-link.js +22 -22
- package/dist/components/mixins/themeMixin.js +43 -43
- package/dist/components/noticebar/index.js +8 -8
- package/dist/components/noticebar/index.vue +258 -258
- package/dist/components/noticebar/style.less +333 -333
- package/dist/components/overlay/index.js +8 -8
- package/dist/components/overlay/index.vue +184 -184
- package/dist/components/overlay/style.less +24 -24
- package/dist/components/pagebreak/index.js +6 -6
- package/dist/components/pagebreak/index.vue +67 -67
- package/dist/components/pagebreak/style.less +41 -41
- package/dist/components/password/index.js +8 -8
- package/dist/components/password/index.vue +64 -64
- package/dist/components/popover/index.js +8 -8
- package/dist/components/popover/index.vue +100 -100
- package/dist/components/popover/style.less +346 -346
- package/dist/components/popover/vue-popover.vue +314 -314
- package/dist/components/popup/index.js +7 -7
- package/dist/components/popup/index.vue +165 -165
- package/dist/components/popup/style.less +78 -78
- package/dist/components/radio/index.js +8 -8
- package/dist/components/radio/index.vue +184 -184
- package/dist/components/radio/style.less +300 -300
- package/dist/components/radio-group/index.js +7 -7
- package/dist/components/radio-group/index.vue +62 -62
- package/dist/components/result/index.js +8 -8
- package/dist/components/result/index.vue +73 -73
- package/dist/components/result/style.less +43 -43
- package/dist/components/search/index.js +8 -8
- package/dist/components/search/index.vue +70 -70
- package/dist/components/selector/index.js +8 -8
- package/dist/components/selector/index.vue +161 -161
- package/dist/components/selector/style.less +484 -484
- package/dist/components/skeleton/index.js +6 -6
- package/dist/components/skeleton/index.vue +207 -207
- package/dist/components/skeleton/style.less +196 -196
- package/dist/components/slider/draggable.js +49 -49
- package/dist/components/slider/index.js +6 -6
- package/dist/components/slider/index.vue +167 -167
- package/dist/components/slider/style.less +99 -99
- package/dist/components/slider/utils.js +59 -59
- package/dist/components/step/index.js +7 -7
- package/dist/components/step/index.vue +48 -48
- package/dist/components/step/style.less +66 -66
- package/dist/components/step-item/index.js +7 -7
- package/dist/components/step-item/index.vue +126 -126
- package/dist/components/step-item/style.less +399 -399
- package/dist/components/stepper/index.js +8 -8
- package/dist/components/stepper/index.vue +150 -150
- package/dist/components/style/index.vue +42 -42
- package/dist/components/switch/index.js +8 -8
- package/dist/components/switch/index.vue +72 -72
- package/dist/components/switch/style.less +56 -56
- package/dist/components/tab/index.js +7 -7
- package/dist/components/tab/index.vue +97 -97
- package/dist/components/tabs/index.js +8 -8
- package/dist/components/tabs/index.vue +356 -356
- package/dist/components/tabs/style.less +511 -504
- package/dist/components/tag/index.js +6 -6
- package/dist/components/tag/index.vue +64 -64
- package/dist/components/tag/style.less +210 -210
- package/dist/components/title/index.js +8 -8
- package/dist/components/title/index.vue +99 -99
- package/dist/components/title/style.less +187 -187
- package/dist/components/toast/index.js +139 -139
- package/dist/components/toast/index.vue +50 -50
- package/dist/components/toast/style.less +58 -58
- package/dist/components/transition/index.js +8 -8
- package/dist/components/transition/index.vue +13 -13
- package/dist/components/transition/style.less +208 -208
- package/dist/components/upload/index.js +6 -6
- package/dist/components/upload/index.vue +106 -106
- package/dist/components/upload/style.less +147 -147
- package/dist/components/utils/assist.js +34 -34
- package/dist/components/utils/env.js +21 -21
- package/dist/locale/ar.js +97 -97
- package/dist/locale/en.js +97 -97
- package/dist/locale/zh.js +97 -97
- package/dist/token.css +9 -9
- package/dist/vdesign-ui.common.js +83 -83
- package/dist/vdesign-ui.css +1 -1
- package/dist/vdesign-ui.umd.js +83 -83
- package/package.json +113 -113
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
@actions-prefix-cls: vd-actions;
|
|
2
|
-
|
|
3
|
-
.@{actions-prefix-cls} {
|
|
4
|
-
height: 100%;
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
|
|
9
|
-
&__list {
|
|
10
|
-
width: fit-content;
|
|
11
|
-
min-width: var(--width-actions-form_small);
|
|
12
|
-
max-width: var(--width-actions-form_large);
|
|
13
|
-
padding: 0 var(--spacing-actions-form-padding_y);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&__card {
|
|
17
|
-
padding: 0 var(--spacing-actions-card_item-margin_y);
|
|
18
|
-
|
|
19
|
-
.@{actions-prefix-cls}__content {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
border-radius: 50%;
|
|
24
|
-
width: var(--width-actions-card);
|
|
25
|
-
height: var(--width-actions-card);
|
|
26
|
-
|
|
27
|
-
&--green {
|
|
28
|
-
background-color: var(--color-actions-bg-green);
|
|
29
|
-
&--disabled {
|
|
30
|
-
background-color: var(--color-actions-bg-green-disable);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&--warning {
|
|
35
|
-
background-color: var(--color-actions-bg-warning);
|
|
36
|
-
&--disabled {
|
|
37
|
-
background-color: var(--color-actions-bg-warning-disable);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&--blue {
|
|
42
|
-
background-color: var(--color-actions-bg-blue);
|
|
43
|
-
&--disabled {
|
|
44
|
-
background-color: var(--color-actions-bg-blue-disable);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&--gray {
|
|
49
|
-
background-color: var(--color-actions-bg-gray);
|
|
50
|
-
&--disabled {
|
|
51
|
-
background-color: var(--color-actions-bg-gray-disable);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.@{actions-prefix-cls}__icon {
|
|
57
|
-
color: var(--color-actions-text);
|
|
58
|
-
font-size: var(--icon-actions-card);
|
|
59
|
-
&--disabled {
|
|
60
|
-
color: var(--color-actions-text-disable);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&__text {
|
|
66
|
-
color: var(--color-actions-text);
|
|
67
|
-
font-size: var(--en-single-f-d-s-fontSize);
|
|
68
|
-
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
69
|
-
&--disabled {
|
|
70
|
-
color: var(--color-actions-text-disable);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&__icon {
|
|
75
|
-
font-size: var(--icon-actions-size);
|
|
76
|
-
color: var(--color-actions-text);
|
|
77
|
-
&--disabled {
|
|
78
|
-
color: var(--color-actions-text-disable);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&__green {
|
|
83
|
-
background-color: var(--color-actions-bg-green);
|
|
84
|
-
&--disabled {
|
|
85
|
-
background-color: var(--color-actions-bg-green-disable);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&__warning {
|
|
90
|
-
background-color: var(--color-actions-bg-warning);
|
|
91
|
-
&--disabled {
|
|
92
|
-
background-color: var(--color-actions-bg-warning-disable);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&__blue {
|
|
97
|
-
background-color: var(--color-actions-bg-blue);
|
|
98
|
-
&--disabled {
|
|
99
|
-
background-color: var(--color-actions-bg-blue-disable);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
&__gray {
|
|
104
|
-
background-color: var(--color-actions-bg-gray);
|
|
105
|
-
&--disabled {
|
|
106
|
-
background-color: var(--color-actions-bg-gray-disable);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
1
|
+
@actions-prefix-cls: vd-actions;
|
|
2
|
+
|
|
3
|
+
.@{actions-prefix-cls} {
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
|
|
9
|
+
&__list {
|
|
10
|
+
width: fit-content;
|
|
11
|
+
min-width: var(--width-actions-form_small);
|
|
12
|
+
max-width: var(--width-actions-form_large);
|
|
13
|
+
padding: 0 var(--spacing-actions-form-padding_y);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__card {
|
|
17
|
+
padding: 0 var(--spacing-actions-card_item-margin_y);
|
|
18
|
+
|
|
19
|
+
.@{actions-prefix-cls}__content {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
width: var(--width-actions-card);
|
|
25
|
+
height: var(--width-actions-card);
|
|
26
|
+
|
|
27
|
+
&--green {
|
|
28
|
+
background-color: var(--color-actions-bg-green);
|
|
29
|
+
&--disabled {
|
|
30
|
+
background-color: var(--color-actions-bg-green-disable);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&--warning {
|
|
35
|
+
background-color: var(--color-actions-bg-warning);
|
|
36
|
+
&--disabled {
|
|
37
|
+
background-color: var(--color-actions-bg-warning-disable);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--blue {
|
|
42
|
+
background-color: var(--color-actions-bg-blue);
|
|
43
|
+
&--disabled {
|
|
44
|
+
background-color: var(--color-actions-bg-blue-disable);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--gray {
|
|
49
|
+
background-color: var(--color-actions-bg-gray);
|
|
50
|
+
&--disabled {
|
|
51
|
+
background-color: var(--color-actions-bg-gray-disable);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.@{actions-prefix-cls}__icon {
|
|
57
|
+
color: var(--color-actions-text);
|
|
58
|
+
font-size: var(--icon-actions-card);
|
|
59
|
+
&--disabled {
|
|
60
|
+
color: var(--color-actions-text-disable);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&__text {
|
|
66
|
+
color: var(--color-actions-text);
|
|
67
|
+
font-size: var(--en-single-f-d-s-fontSize);
|
|
68
|
+
font-weight: var(--en-single-f-d-s-fontWeight);
|
|
69
|
+
&--disabled {
|
|
70
|
+
color: var(--color-actions-text-disable);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__icon {
|
|
75
|
+
font-size: var(--icon-actions-size);
|
|
76
|
+
color: var(--color-actions-text);
|
|
77
|
+
&--disabled {
|
|
78
|
+
color: var(--color-actions-text-disable);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&__green {
|
|
83
|
+
background-color: var(--color-actions-bg-green);
|
|
84
|
+
&--disabled {
|
|
85
|
+
background-color: var(--color-actions-bg-green-disable);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&__warning {
|
|
90
|
+
background-color: var(--color-actions-bg-warning);
|
|
91
|
+
&--disabled {
|
|
92
|
+
background-color: var(--color-actions-bg-warning-disable);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&__blue {
|
|
97
|
+
background-color: var(--color-actions-bg-blue);
|
|
98
|
+
&--disabled {
|
|
99
|
+
background-color: var(--color-actions-bg-blue-disable);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&__gray {
|
|
104
|
+
background-color: var(--color-actions-bg-gray);
|
|
105
|
+
&--disabled {
|
|
106
|
+
background-color: var(--color-actions-bg-gray-disable);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import ActionsCell from './index.vue';
|
|
2
|
-
import './style.less';
|
|
3
|
-
ActionsCell.install = function(Vue) {
|
|
4
|
-
Vue.component(ActionsCell.name, ActionsCell)
|
|
5
|
-
}
|
|
6
|
-
|
|
1
|
+
import ActionsCell from './index.vue';
|
|
2
|
+
import './style.less';
|
|
3
|
+
ActionsCell.install = function(Vue) {
|
|
4
|
+
Vue.component(ActionsCell.name, ActionsCell)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
7
|
export default ActionsCell;
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vd-actions-cell">
|
|
3
|
-
<div class="vd-actions-cell__wrapper" :style="{ transform: `translateX(${offset}px)` }"
|
|
4
|
-
@touchstart="handleTouchStart" @touchmove="handleTouchMove" @touchend="handleTouchEnd" @click="handleClick">
|
|
5
|
-
<div class="vd-actions-cell__left" ref="leftButton">
|
|
6
|
-
<slot name="left"></slot>
|
|
7
|
-
</div>
|
|
8
|
-
<slot name="content"></slot>
|
|
9
|
-
<div class="vd-actions-cell__right" ref="rightButton">
|
|
10
|
-
<slot name="right"></slot>
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
export default {
|
|
18
|
-
name: 'vd-actions-cell',
|
|
19
|
-
props: {
|
|
20
|
-
},
|
|
21
|
-
data() {
|
|
22
|
-
return {
|
|
23
|
-
offset: 0, // 初始偏移量
|
|
24
|
-
startX: 0, // 按下时的X坐标
|
|
25
|
-
lastX: 0, // 上一次移动的X坐标
|
|
26
|
-
isDragging: false // 是否正在拖动
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
computed: {
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
methods: {
|
|
33
|
-
handleTouchStart(event) {
|
|
34
|
-
this.startX = event.touches[0].pageX;
|
|
35
|
-
this.lastX = this.startX;
|
|
36
|
-
this.isDragging = true;
|
|
37
|
-
},
|
|
38
|
-
handleTouchMove(event) {
|
|
39
|
-
if (!this.isDragging) return;
|
|
40
|
-
|
|
41
|
-
const currentX = event.touches[0].pageX;
|
|
42
|
-
const deltaX = currentX - this.lastX;
|
|
43
|
-
|
|
44
|
-
// // 判断滑动的方向
|
|
45
|
-
// if (deltaX > 0) {
|
|
46
|
-
// // 向右侧滑动
|
|
47
|
-
// // 这里可以执行相应的逻辑
|
|
48
|
-
// this.offset = 0;
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// this.lastX = currentX;
|
|
52
|
-
// 计算内容区域的新偏移量
|
|
53
|
-
this.offset += deltaX;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// // 限制内容区域的滑动范围在按钮的宽度以内
|
|
57
|
-
// const buttonWidth = this.$refs.rightButton.offsetWidth;
|
|
58
|
-
// const maxOffset = buttonWidth >= 0 ? buttonWidth : 0;
|
|
59
|
-
// this.offset = Math.max(-maxOffset, Math.min(0, this.offset));
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const rightButtonWidth = this.$refs.rightButton.offsetWidth;
|
|
63
|
-
const leftButtonWidth = this.$refs.leftButton.offsetWidth;
|
|
64
|
-
this.offset = Math.max(-rightButtonWidth, Math.min(leftButtonWidth, this.offset));
|
|
65
|
-
this.startX = currentX;
|
|
66
|
-
},
|
|
67
|
-
handleTouchEnd() {
|
|
68
|
-
this.isDragging = false;
|
|
69
|
-
const rightButtonWidth = this.$refs.rightButton.offsetWidth;
|
|
70
|
-
const leftButtonWidth = this.$refs.leftButton.offsetWidth;
|
|
71
|
-
const thresholdRight = rightButtonWidth / 3;
|
|
72
|
-
const thresholdLeft = leftButtonWidth / 3;
|
|
73
|
-
|
|
74
|
-
if (this.offset < -thresholdRight) {
|
|
75
|
-
// 向左侧滑动超过三分之一,显示右侧按钮
|
|
76
|
-
this.offset = -rightButtonWidth;
|
|
77
|
-
} else if (this.offset > thresholdLeft) {
|
|
78
|
-
// 向右侧滑动超过三分之一,显示左侧按钮
|
|
79
|
-
this.offset = leftButtonWidth;
|
|
80
|
-
} else {
|
|
81
|
-
// 按钮偏移不超过三分之一,按钮回到原位
|
|
82
|
-
this.offset = 0;
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
handleClick() {
|
|
86
|
-
this.offset = 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<style lang="less">
|
|
93
|
-
@import './style.less';
|
|
94
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vd-actions-cell">
|
|
3
|
+
<div class="vd-actions-cell__wrapper" :style="{ transform: `translateX(${offset}px)` }"
|
|
4
|
+
@touchstart="handleTouchStart" @touchmove="handleTouchMove" @touchend="handleTouchEnd" @click="handleClick">
|
|
5
|
+
<div class="vd-actions-cell__left" ref="leftButton">
|
|
6
|
+
<slot name="left"></slot>
|
|
7
|
+
</div>
|
|
8
|
+
<slot name="content"></slot>
|
|
9
|
+
<div class="vd-actions-cell__right" ref="rightButton">
|
|
10
|
+
<slot name="right"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'vd-actions-cell',
|
|
19
|
+
props: {
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
offset: 0, // 初始偏移量
|
|
24
|
+
startX: 0, // 按下时的X坐标
|
|
25
|
+
lastX: 0, // 上一次移动的X坐标
|
|
26
|
+
isDragging: false // 是否正在拖动
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
computed: {
|
|
30
|
+
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
handleTouchStart(event) {
|
|
34
|
+
this.startX = event.touches[0].pageX;
|
|
35
|
+
this.lastX = this.startX;
|
|
36
|
+
this.isDragging = true;
|
|
37
|
+
},
|
|
38
|
+
handleTouchMove(event) {
|
|
39
|
+
if (!this.isDragging) return;
|
|
40
|
+
|
|
41
|
+
const currentX = event.touches[0].pageX;
|
|
42
|
+
const deltaX = currentX - this.lastX;
|
|
43
|
+
|
|
44
|
+
// // 判断滑动的方向
|
|
45
|
+
// if (deltaX > 0) {
|
|
46
|
+
// // 向右侧滑动
|
|
47
|
+
// // 这里可以执行相应的逻辑
|
|
48
|
+
// this.offset = 0;
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
// this.lastX = currentX;
|
|
52
|
+
// 计算内容区域的新偏移量
|
|
53
|
+
this.offset += deltaX;
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// // 限制内容区域的滑动范围在按钮的宽度以内
|
|
57
|
+
// const buttonWidth = this.$refs.rightButton.offsetWidth;
|
|
58
|
+
// const maxOffset = buttonWidth >= 0 ? buttonWidth : 0;
|
|
59
|
+
// this.offset = Math.max(-maxOffset, Math.min(0, this.offset));
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const rightButtonWidth = this.$refs.rightButton.offsetWidth;
|
|
63
|
+
const leftButtonWidth = this.$refs.leftButton.offsetWidth;
|
|
64
|
+
this.offset = Math.max(-rightButtonWidth, Math.min(leftButtonWidth, this.offset));
|
|
65
|
+
this.startX = currentX;
|
|
66
|
+
},
|
|
67
|
+
handleTouchEnd() {
|
|
68
|
+
this.isDragging = false;
|
|
69
|
+
const rightButtonWidth = this.$refs.rightButton.offsetWidth;
|
|
70
|
+
const leftButtonWidth = this.$refs.leftButton.offsetWidth;
|
|
71
|
+
const thresholdRight = rightButtonWidth / 3;
|
|
72
|
+
const thresholdLeft = leftButtonWidth / 3;
|
|
73
|
+
|
|
74
|
+
if (this.offset < -thresholdRight) {
|
|
75
|
+
// 向左侧滑动超过三分之一,显示右侧按钮
|
|
76
|
+
this.offset = -rightButtonWidth;
|
|
77
|
+
} else if (this.offset > thresholdLeft) {
|
|
78
|
+
// 向右侧滑动超过三分之一,显示左侧按钮
|
|
79
|
+
this.offset = leftButtonWidth;
|
|
80
|
+
} else {
|
|
81
|
+
// 按钮偏移不超过三分之一,按钮回到原位
|
|
82
|
+
this.offset = 0;
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
handleClick() {
|
|
86
|
+
this.offset = 0;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style lang="less">
|
|
93
|
+
@import './style.less';
|
|
94
|
+
</style>
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
@actions-cell-prefix-cls:vd-actions-cell;
|
|
2
|
-
|
|
3
|
-
.@{actions-cell-prefix-cls}{
|
|
4
|
-
height: 100%;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
position: relative;
|
|
7
|
-
cursor: grab;
|
|
8
|
-
|
|
9
|
-
&__left{
|
|
10
|
-
position: absolute;
|
|
11
|
-
top: 0;
|
|
12
|
-
left: 0;
|
|
13
|
-
height: 100%;
|
|
14
|
-
transform: translate3d(-100%, 0, 0);
|
|
15
|
-
display: flex;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&__right{
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
right: 0;
|
|
22
|
-
height: 100%;
|
|
23
|
-
transform: translate3d(100%, 0, 0);
|
|
24
|
-
display: flex;
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
&__wrapper{
|
|
30
|
-
height: 100%;
|
|
31
|
-
-webkit-transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
|
|
32
|
-
transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
|
|
33
|
-
-webkit-transition-property: -webkit-transform;
|
|
34
|
-
transition-property: -webkit-transform;
|
|
35
|
-
transition-property: transform;
|
|
36
|
-
transition-property: transform, -webkit-transform;
|
|
37
|
-
transition-duration: 0.6s;
|
|
38
|
-
}
|
|
1
|
+
@actions-cell-prefix-cls:vd-actions-cell;
|
|
2
|
+
|
|
3
|
+
.@{actions-cell-prefix-cls}{
|
|
4
|
+
height: 100%;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
position: relative;
|
|
7
|
+
cursor: grab;
|
|
8
|
+
|
|
9
|
+
&__left{
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
height: 100%;
|
|
14
|
+
transform: translate3d(-100%, 0, 0);
|
|
15
|
+
display: flex;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__right{
|
|
19
|
+
position: absolute;
|
|
20
|
+
top: 0;
|
|
21
|
+
right: 0;
|
|
22
|
+
height: 100%;
|
|
23
|
+
transform: translate3d(100%, 0, 0);
|
|
24
|
+
display: flex;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
&__wrapper{
|
|
30
|
+
height: 100%;
|
|
31
|
+
-webkit-transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
|
|
32
|
+
transition-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1);
|
|
33
|
+
-webkit-transition-property: -webkit-transform;
|
|
34
|
+
transition-property: -webkit-transform;
|
|
35
|
+
transition-property: transform;
|
|
36
|
+
transition-property: transform, -webkit-transform;
|
|
37
|
+
transition-duration: 0.6s;
|
|
38
|
+
}
|
|
39
39
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Activityviews from './index.vue';
|
|
2
|
-
import './style.less';
|
|
3
|
-
|
|
4
|
-
Activityviews.install = function (Vue) {
|
|
5
|
-
Vue.component(Activityviews.name, Activityviews);
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default Activityviews;
|
|
1
|
+
import Activityviews from './index.vue';
|
|
2
|
+
import './style.less';
|
|
3
|
+
|
|
4
|
+
Activityviews.install = function (Vue) {
|
|
5
|
+
Vue.component(Activityviews.name, Activityviews);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default Activityviews;
|