@zkwq/business 0.0.4 → 0.0.6
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 +2 -2
- package/src/components/base/ui/alert/Alert.vue +0 -94
- package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +0 -77
- package/src/components/base/ui/autocomplete/autocomplete.vue +0 -305
- package/src/components/base/ui/backtop/main.vue +0 -112
- package/src/components/base/ui/button/Button.vue +0 -84
- package/src/components/base/ui/button/ButtonGroup.vue +0 -10
- package/src/components/base/ui/carousel/Carousel.vue +0 -304
- package/src/components/base/ui/carousel/CarouselItem.vue +0 -137
- package/src/components/base/ui/cascader/cascader.vue +0 -650
- package/src/components/base/ui/cascader-panel/cascader-menu.vue +0 -138
- package/src/components/base/ui/cascader-panel/cascader-node.vue +0 -246
- package/src/components/base/ui/cascader-panel/cascader-panel.vue +0 -382
- package/src/components/base/ui/cascader-panel/node.js +0 -166
- package/src/components/base/ui/cascader-panel/store.js +0 -62
- package/src/components/base/ui/checkbox/checkbox-button.vue +0 -199
- package/src/components/base/ui/checkbox/checkbox-group.vue +0 -48
- package/src/components/base/ui/checkbox/checkbox.vue +0 -222
- package/src/components/base/ui/col/col.js +0 -71
- package/src/components/base/ui/collapse/collapse-item.vue +0 -180
- package/src/components/base/ui/collapse/collapse.vue +0 -73
- package/src/components/base/ui/color-picker/color.js +0 -317
- package/src/components/base/ui/color-picker/components/alpha-slider.vue +0 -132
- package/src/components/base/ui/color-picker/components/hue-slider.vue +0 -123
- package/src/components/base/ui/color-picker/components/picker-dropdown.vue +0 -119
- package/src/components/base/ui/color-picker/components/predefine.vue +0 -61
- package/src/components/base/ui/color-picker/components/sv-panel.vue +0 -100
- package/src/components/base/ui/color-picker/draggable.js +0 -36
- package/src/components/base/ui/color-picker/index.js +0 -2
- package/src/components/base/ui/color-picker/main.vue +0 -188
- package/src/components/base/ui/date-picker/basic/date-table.vue +0 -441
- package/src/components/base/ui/date-picker/basic/month-table.vue +0 -254
- package/src/components/base/ui/date-picker/basic/time-spinner.vue +0 -304
- package/src/components/base/ui/date-picker/basic/year-table.vue +0 -101
- package/src/components/base/ui/date-picker/panel/date-range.vue +0 -680
- package/src/components/base/ui/date-picker/panel/date.vue +0 -597
- package/src/components/base/ui/date-picker/panel/month-range.vue +0 -289
- package/src/components/base/ui/date-picker/panel/time-range.vue +0 -248
- package/src/components/base/ui/date-picker/panel/time-select.vue +0 -178
- package/src/components/base/ui/date-picker/panel/time.vue +0 -186
- package/src/components/base/ui/date-picker/picker/date-picker.js +0 -43
- package/src/components/base/ui/date-picker/picker/time-picker.js +0 -39
- package/src/components/base/ui/date-picker/picker/time-select.js +0 -21
- package/src/components/base/ui/date-picker/picker.vue +0 -942
- package/src/components/base/ui/dialog/Index.vue +0 -212
- package/src/components/base/ui/directive/repeat-click.js +0 -24
- package/src/components/base/ui/directive/ripple.js +0 -303
- package/src/components/base/ui/divider/Divider.vue +0 -37
- package/src/components/base/ui/drawer/Drawer.vue +0 -202
- package/src/components/base/ui/dropdown/dropdown-item.vue +0 -39
- package/src/components/base/ui/dropdown/dropdown-menu.vue +0 -63
- package/src/components/base/ui/dropdown/dropdown.vue +0 -308
- package/src/components/base/ui/form/Form.vue +0 -167
- package/src/components/base/ui/form/FormItem.vue +0 -334
- package/src/components/base/ui/form/LabelWrap.vue +0 -69
- package/src/components/base/ui/icon/icon.vue +0 -13
- package/src/components/base/ui/image/image-viewer.vue +0 -302
- package/src/components/base/ui/image/main.vue +0 -248
- package/src/components/base/ui/index.js +0 -189
- package/src/components/base/ui/input/Input.vue +0 -438
- package/src/components/base/ui/input/calcTextareaHeight.js +0 -104
- package/src/components/base/ui/input-number/input-number.vue +0 -285
- package/src/components/base/ui/locale/format.js +0 -32
- package/src/components/base/ui/locale/index.js +0 -48
- package/src/components/base/ui/locale/lang/zh-CN.js +0 -120
- package/src/components/base/ui/menu/menu-item-group.vue +0 -45
- package/src/components/base/ui/menu/menu-item.vue +0 -112
- package/src/components/base/ui/menu/menu-mixin.js +0 -44
- package/src/components/base/ui/menu/menu.vue +0 -312
- package/src/components/base/ui/menu/submenu.vue +0 -408
- package/src/components/base/ui/message/index.js +0 -2
- package/src/components/base/ui/message/main.js +0 -87
- package/src/components/base/ui/message/main.vue +0 -110
- package/src/components/base/ui/message-box/main.js +0 -216
- package/src/components/base/ui/message-box/main.vue +0 -323
- package/src/components/base/ui/mixin/emitter.js +0 -31
- package/src/components/base/ui/mixin/focus.js +0 -9
- package/src/components/base/ui/mixin/locale.js +0 -9
- package/src/components/base/ui/mixin/migrating.js +0 -33
- package/src/components/base/ui/pagination/pager.vue +0 -163
- package/src/components/base/ui/pagination/pagination.jsx +0 -391
- package/src/components/base/ui/popover/directive.js +0 -20
- package/src/components/base/ui/popover/index.js +0 -14
- package/src/components/base/ui/popover/main.vue +0 -236
- package/src/components/base/ui/progress/Progress.vue +0 -227
- package/src/components/base/ui/radio/radio-button.vue +0 -114
- package/src/components/base/ui/radio/radio-group.vue +0 -111
- package/src/components/base/ui/radio/radio.vue +0 -134
- package/src/components/base/ui/row/row.js +0 -47
- package/src/components/base/ui/scrollbar/bar.jsx +0 -91
- package/src/components/base/ui/scrollbar/index.jsx +0 -203
- package/src/components/base/ui/scrollbar/util.js +0 -32
- package/src/components/base/ui/select/Option.vue +0 -168
- package/src/components/base/ui/select/OptionGroup.vue +0 -60
- package/src/components/base/ui/select/Select.vue +0 -920
- package/src/components/base/ui/select/SelectDropdown.vue +0 -74
- package/src/components/base/ui/select/navigation-mixin.js +0 -54
- package/src/components/base/ui/skeleton/index.js +0 -8
- package/src/components/base/ui/skeleton/src/img-placeholder.vue +0 -16
- package/src/components/base/ui/skeleton/src/index.vue +0 -80
- package/src/components/base/ui/skeleton/src/item.vue +0 -22
- package/src/components/base/ui/skeleton-item/index.js +0 -8
- package/src/components/base/ui/slider/button.vue +0 -238
- package/src/components/base/ui/slider/main.vue +0 -427
- package/src/components/base/ui/slider/marker.js +0 -18
- package/src/components/base/ui/style/alert.scss +0 -147
- package/src/components/base/ui/style/animations.scss +0 -65
- package/src/components/base/ui/style/autocomplete.scss +0 -81
- package/src/components/base/ui/style/backtop.scss +0 -20
- package/src/components/base/ui/style/button-group.scss +0 -0
- package/src/components/base/ui/style/button.scss +0 -380
- package/src/components/base/ui/style/carousel-item.scss +0 -50
- package/src/components/base/ui/style/carousel.scss +0 -161
- package/src/components/base/ui/style/cascader-panel.scss +0 -120
- package/src/components/base/ui/style/cascader.scss +0 -185
- package/src/components/base/ui/style/checkbox-button.scss +0 -0
- package/src/components/base/ui/style/checkbox-group.scss +0 -0
- package/src/components/base/ui/style/checkbox.scss +0 -360
- package/src/components/base/ui/style/col.scss +0 -156
- package/src/components/base/ui/style/collapse-item.scss +0 -0
- package/src/components/base/ui/style/collapse.scss +0 -114
- package/src/components/base/ui/style/color-picker.scss +0 -387
- package/src/components/base/ui/style/config.scss +0 -4
- package/src/components/base/ui/style/date-picker/date-picker.scss +0 -97
- package/src/components/base/ui/style/date-picker/date-range-picker.scss +0 -101
- package/src/components/base/ui/style/date-picker/date-table.scss +0 -151
- package/src/components/base/ui/style/date-picker/month-table.scss +0 -82
- package/src/components/base/ui/style/date-picker/picker-panel.scss +0 -117
- package/src/components/base/ui/style/date-picker/picker.scss +0 -197
- package/src/components/base/ui/style/date-picker/time-picker.scss +0 -85
- package/src/components/base/ui/style/date-picker/time-range-picker.scss +0 -31
- package/src/components/base/ui/style/date-picker/time-spinner.scss +0 -110
- package/src/components/base/ui/style/date-picker/year-table.scss +0 -51
- package/src/components/base/ui/style/date-picker.scss +0 -12
- package/src/components/base/ui/style/dialog.scss +0 -123
- package/src/components/base/ui/style/divider.scss +0 -47
- package/src/components/base/ui/style/drawer.scss +0 -218
- package/src/components/base/ui/style/dropdown-item.scss +0 -0
- package/src/components/base/ui/style/dropdown-menu.scss +0 -0
- package/src/components/base/ui/style/dropdown.scss +0 -185
- package/src/components/base/ui/style/form-item.scss +0 -0
- package/src/components/base/ui/style/form.scss +0 -203
- package/src/components/base/ui/style/function.scss +0 -43
- package/src/components/base/ui/style/icon.scss +0 -1167
- package/src/components/base/ui/style/image.scss +0 -184
- package/src/components/base/ui/style/index.scss +0 -57
- package/src/components/base/ui/style/input-number.scss +0 -187
- package/src/components/base/ui/style/input.scss +0 -477
- package/src/components/base/ui/style/menu-item-group.scss +0 -0
- package/src/components/base/ui/style/menu-item.scss +0 -0
- package/src/components/base/ui/style/menu.scss +0 -294
- package/src/components/base/ui/style/message-box.scss +0 -231
- package/src/components/base/ui/style/message.scss +0 -120
- package/src/components/base/ui/style/mixins.scss +0 -196
- package/src/components/base/ui/style/option-group.scss +0 -42
- package/src/components/base/ui/style/option.scss +0 -36
- package/src/components/base/ui/style/pagination.scss +0 -295
- package/src/components/base/ui/style/popover.scss +0 -40
- package/src/components/base/ui/style/popper.scss +0 -102
- package/src/components/base/ui/style/popup.scss +0 -42
- package/src/components/base/ui/style/progress.scss +0 -141
- package/src/components/base/ui/style/radio-button.scss +0 -113
- package/src/components/base/ui/style/radio-group.scss +0 -9
- package/src/components/base/ui/style/radio.scss +0 -203
- package/src/components/base/ui/style/ripple.scss +0 -35
- package/src/components/base/ui/style/row.scss +0 -39
- package/src/components/base/ui/style/scrollbar.scss +0 -75
- package/src/components/base/ui/style/select-dropdown.scss +0 -59
- package/src/components/base/ui/style/select.scss +0 -154
- package/src/components/base/ui/style/skeleton-item.scss +0 -84
- package/src/components/base/ui/style/skeleton.scss +0 -40
- package/src/components/base/ui/style/slider.scss +0 -250
- package/src/components/base/ui/style/switch.scss +0 -116
- package/src/components/base/ui/style/tabs.scss +0 -602
- package/src/components/base/ui/style/tag.scss +0 -174
- package/src/components/base/ui/style/tooltip.scss +0 -146
- package/src/components/base/ui/style/transition.scss +0 -138
- package/src/components/base/ui/style/upload.scss +0 -603
- package/src/components/base/ui/style/utils.scss +0 -39
- package/src/components/base/ui/style/var.scss +0 -1011
- package/src/components/base/ui/switch/index.vue +0 -174
- package/src/components/base/ui/tabs/tab-bar.vue +0 -57
- package/src/components/base/ui/tabs/tab-nav.vue +0 -294
- package/src/components/base/ui/tabs/tab-pane.vue +0 -56
- package/src/components/base/ui/tabs/tabs.vue +0 -191
- package/src/components/base/ui/tag/Tag.vue +0 -60
- package/src/components/base/ui/tooltip/tooltip.jsx +0 -234
- package/src/components/base/ui/upload/Index.vue +0 -340
- package/src/components/base/ui/upload/Upload.vue +0 -216
- package/src/components/base/ui/upload/UploadDragger.vue +0 -70
- package/src/components/base/ui/upload/UploadList.vue +0 -100
- package/src/components/base/ui/upload/ajax.js +0 -85
- package/src/components/base/ui/util/aria-dialog.js +0 -90
- package/src/components/base/ui/util/aria-utils.js +0 -122
- package/src/components/base/ui/util/clickoutside.js +0 -76
- package/src/components/base/ui/util/date-util.js +0 -292
- package/src/components/base/ui/util/date.js +0 -355
- package/src/components/base/ui/util/debounce.js +0 -21
- package/src/components/base/ui/util/deepmerge.js +0 -100
- package/src/components/base/ui/util/dom.js +0 -215
- package/src/components/base/ui/util/index.js +0 -262
- package/src/components/base/ui/util/menu/aria-menubar.js +0 -14
- package/src/components/base/ui/util/menu/aria-menuitem.js +0 -49
- package/src/components/base/ui/util/menu/aria-submenu.js +0 -59
- package/src/components/base/ui/util/merge.js +0 -14
- package/src/components/base/ui/util/popper.js +0 -1235
- package/src/components/base/ui/util/popup/index.js +0 -218
- package/src/components/base/ui/util/popup/popup-manager.js +0 -194
- package/src/components/base/ui/util/resize-events.js +0 -32
- package/src/components/base/ui/util/scroll-into-view.js +0 -27
- package/src/components/base/ui/util/scrollbar-width.js +0 -29
- package/src/components/base/ui/util/shared.js +0 -7
- package/src/components/base/ui/util/throttle.js +0 -91
- package/src/components/base/ui/util/types.js +0 -24
- package/src/components/base/ui/util/vdom.js +0 -5
- package/src/components/base/ui/util/vue-popper.js +0 -188
- package/src/components/normal/AggsItemH.vue +0 -145
- package/src/index.js +0 -10
- package/src/static/base-icons.ttf +0 -0
- package/src/static/base-icons.woff +0 -0
- package/src/static/label_bg.png +0 -0
- package/src/static/term-label-bg.png +0 -0
- package/src/style/app-article.scss +0 -698
- package/src/style/app-comment.scss +0 -259
- package/src/style/app-recommend.scss +0 -48
- package/src/style/app-richtext.scss +0 -176
- package/src/style/index.scss +0 -523
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="base-collapse-item"
|
|
3
|
-
:class="{'is-active': isActive, 'is-disabled': disabled }">
|
|
4
|
-
<div
|
|
5
|
-
role="tab"
|
|
6
|
-
:aria-expanded="isActive"
|
|
7
|
-
:aria-controls="`base-collapse-content-${id}`"
|
|
8
|
-
:aria-describedby ="`base-collapse-content-${id}`"
|
|
9
|
-
>
|
|
10
|
-
<div
|
|
11
|
-
class="base-collapse-item__header"
|
|
12
|
-
@click="handleHeaderClick"
|
|
13
|
-
role="button"
|
|
14
|
-
:id="`base-collapse-head-${id}`"
|
|
15
|
-
:tabindex="disabled ? undefined : 0"
|
|
16
|
-
@keyup.space.enter.stop="handleEnterClick"
|
|
17
|
-
:class="{
|
|
18
|
-
'focusing': focusing,
|
|
19
|
-
'is-active': isActive
|
|
20
|
-
}"
|
|
21
|
-
@focus="handleFocus"
|
|
22
|
-
@blur="focusing = false"
|
|
23
|
-
>
|
|
24
|
-
<slot name="title">{{title}}</slot>
|
|
25
|
-
<i
|
|
26
|
-
class="base-collapse-item__arrow base-icon-caret-right"
|
|
27
|
-
:class="{'is-active': isActive}">
|
|
28
|
-
</i>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
<transition
|
|
32
|
-
v-on:before-enter="beforeEnter"
|
|
33
|
-
v-on:enter="enter"
|
|
34
|
-
v-on:after-enter="afterEnter"
|
|
35
|
-
v-on:before-leave="beforeLeave"
|
|
36
|
-
v-on:leave="leave"
|
|
37
|
-
v-on:after-leave="afterLeave"
|
|
38
|
-
>
|
|
39
|
-
<div
|
|
40
|
-
class="base-collapse-item__wrap"
|
|
41
|
-
v-show="isActive"
|
|
42
|
-
role="tabpanel"
|
|
43
|
-
:aria-hidden="!isActive"
|
|
44
|
-
:aria-labelledby="`base-collapse-head-${id}`"
|
|
45
|
-
:id="`base-collapse-content-${id}`"
|
|
46
|
-
>
|
|
47
|
-
<div class="base-collapse-item__content">
|
|
48
|
-
<slot></slot>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
</transition>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
<script>
|
|
55
|
-
import Emitter from '../mixin/emitter'
|
|
56
|
-
import { generateId } from '../util/index'
|
|
57
|
-
import { addClass, removeClass } from '../util/dom'
|
|
58
|
-
|
|
59
|
-
export default {
|
|
60
|
-
name: 'BaseCollapseItem',
|
|
61
|
-
|
|
62
|
-
componentName: 'BaseCollapseItem',
|
|
63
|
-
|
|
64
|
-
mixins: [Emitter],
|
|
65
|
-
|
|
66
|
-
data() {
|
|
67
|
-
return {
|
|
68
|
-
contentWrapStyle: {
|
|
69
|
-
height: 'auto',
|
|
70
|
-
display: 'block'
|
|
71
|
-
},
|
|
72
|
-
contentHeight: 0,
|
|
73
|
-
focusing: false,
|
|
74
|
-
isClick: false,
|
|
75
|
-
id: generateId()
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
inject: ['collapse'],
|
|
80
|
-
|
|
81
|
-
props: {
|
|
82
|
-
title: String,
|
|
83
|
-
name: {
|
|
84
|
-
type: [String, Number],
|
|
85
|
-
default() {
|
|
86
|
-
return this._uid;
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
disabled: Boolean
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
computed: {
|
|
93
|
-
isActive() {
|
|
94
|
-
return this.collapse.activeNames.indexOf(this.name) > -1;
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
methods: {
|
|
99
|
-
handleFocus() {
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
if (!this.isClick) {
|
|
102
|
-
this.focusing = true;
|
|
103
|
-
} else {
|
|
104
|
-
this.isClick = false;
|
|
105
|
-
}
|
|
106
|
-
}, 50);
|
|
107
|
-
},
|
|
108
|
-
handleHeaderClick() {
|
|
109
|
-
if (this.disabled) return;
|
|
110
|
-
this.dispatch('BaseCollapse', 'item-click', this);
|
|
111
|
-
this.focusing = false;
|
|
112
|
-
this.isClick = true;
|
|
113
|
-
},
|
|
114
|
-
handleEnterClick() {
|
|
115
|
-
this.dispatch('BaseCollapse', 'item-click', this);
|
|
116
|
-
},
|
|
117
|
-
beforeEnter(el) {
|
|
118
|
-
addClass(el, 'collapse-transition');
|
|
119
|
-
if (!el.dataset) el.dataset = {};
|
|
120
|
-
|
|
121
|
-
el.dataset.oldPaddingTop = el.style.paddingTop;
|
|
122
|
-
el.dataset.oldPaddingBottom = el.style.paddingBottom;
|
|
123
|
-
|
|
124
|
-
el.style.height = '0';
|
|
125
|
-
el.style.paddingTop = 0;
|
|
126
|
-
el.style.paddingBottom = 0;
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
enter(el) {
|
|
130
|
-
el.dataset.oldOverflow = el.style.overflow;
|
|
131
|
-
if (el.scrollHeight !== 0) {
|
|
132
|
-
el.style.height = el.scrollHeight + 'px';
|
|
133
|
-
el.style.paddingTop = el.dataset.oldPaddingTop;
|
|
134
|
-
el.style.paddingBottom = el.dataset.oldPaddingBottom;
|
|
135
|
-
} else {
|
|
136
|
-
el.style.height = '';
|
|
137
|
-
el.style.paddingTop = el.dataset.oldPaddingTop;
|
|
138
|
-
el.style.paddingBottom = el.dataset.oldPaddingBottom;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
el.style.overflow = 'hidden';
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
afterEnter(el) {
|
|
145
|
-
// for safari: remove class then reset height is necessary
|
|
146
|
-
removeClass(el, 'collapse-transition');
|
|
147
|
-
el.style.height = '';
|
|
148
|
-
el.style.overflow = el.dataset.oldOverflow;
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
beforeLeave(el) {
|
|
152
|
-
if (!el.dataset) el.dataset = {};
|
|
153
|
-
el.dataset.oldPaddingTop = el.style.paddingTop;
|
|
154
|
-
el.dataset.oldPaddingBottom = el.style.paddingBottom;
|
|
155
|
-
el.dataset.oldOverflow = el.style.overflow;
|
|
156
|
-
|
|
157
|
-
el.style.height = el.scrollHeight + 'px';
|
|
158
|
-
el.style.overflow = 'hidden';
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
leave(el) {
|
|
162
|
-
if (el.scrollHeight !== 0) {
|
|
163
|
-
// for safari: add class after set height, or it will jump to zero height suddenly, weired
|
|
164
|
-
addClass(el, 'collapse-transition');
|
|
165
|
-
el.style.height = 0;
|
|
166
|
-
el.style.paddingTop = 0;
|
|
167
|
-
el.style.paddingBottom = 0;
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
afterLeave(el) {
|
|
172
|
-
removeClass(el, 'collapse-transition');
|
|
173
|
-
el.style.height = '';
|
|
174
|
-
el.style.overflow = el.dataset.oldOverflow;
|
|
175
|
-
el.style.paddingTop = el.dataset.oldPaddingTop;
|
|
176
|
-
el.style.paddingBottom = el.dataset.oldPaddingBottom;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
</script>
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="base-collapse" role="tablist" aria-multiselectable="true">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
<script>
|
|
7
|
-
export default {
|
|
8
|
-
name: 'BaseCollapse',
|
|
9
|
-
|
|
10
|
-
componentName: 'BaseCollapse',
|
|
11
|
-
|
|
12
|
-
props: {
|
|
13
|
-
accordion: Boolean,
|
|
14
|
-
value: {
|
|
15
|
-
type: [Array, String, Number],
|
|
16
|
-
default() {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
data() {
|
|
23
|
-
return {
|
|
24
|
-
activeNames: [].concat(this.value)
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
provide() {
|
|
29
|
-
return {
|
|
30
|
-
collapse: this
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
watch: {
|
|
35
|
-
value(value) {
|
|
36
|
-
this.activeNames = [].concat(value);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
methods: {
|
|
41
|
-
setActiveNames(activeNames) {
|
|
42
|
-
activeNames = [].concat(activeNames);
|
|
43
|
-
let value = this.accordion ? activeNames[0] : activeNames;
|
|
44
|
-
this.activeNames = activeNames;
|
|
45
|
-
this.$emit('input', value);
|
|
46
|
-
this.$emit('change', value);
|
|
47
|
-
},
|
|
48
|
-
handleItemClick(item) {
|
|
49
|
-
if (this.accordion) {
|
|
50
|
-
this.setActiveNames(
|
|
51
|
-
(this.activeNames[0] || this.activeNames[0] === 0) &&
|
|
52
|
-
this.activeNames[0] === item.name
|
|
53
|
-
? '' : item.name
|
|
54
|
-
);
|
|
55
|
-
} else {
|
|
56
|
-
let activeNames = this.activeNames.slice(0);
|
|
57
|
-
let index = activeNames.indexOf(item.name);
|
|
58
|
-
|
|
59
|
-
if (index > -1) {
|
|
60
|
-
activeNames.splice(index, 1);
|
|
61
|
-
} else {
|
|
62
|
-
activeNames.push(item.name);
|
|
63
|
-
}
|
|
64
|
-
this.setActiveNames(activeNames);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
|
|
69
|
-
created() {
|
|
70
|
-
this.$on('item-click', this.handleItemClick);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
</script>
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
const hsv2hsl = function(hue, sat, val) {
|
|
2
|
-
return [
|
|
3
|
-
hue,
|
|
4
|
-
(sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue)) || 0,
|
|
5
|
-
hue / 2
|
|
6
|
-
];
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
10
|
-
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
11
|
-
const isOnePointZero = function(n) {
|
|
12
|
-
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const isPercentage = function(n) {
|
|
16
|
-
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
20
|
-
const bound01 = function(value, max) {
|
|
21
|
-
if (isOnePointZero(value)) value = '100%';
|
|
22
|
-
|
|
23
|
-
const processPercent = isPercentage(value);
|
|
24
|
-
value = Math.min(max, Math.max(0, parseFloat(value)));
|
|
25
|
-
|
|
26
|
-
// Automatically convert percentage into number
|
|
27
|
-
if (processPercent) {
|
|
28
|
-
value = parseInt(value * max, 10) / 100;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Handle floating point rounding errors
|
|
32
|
-
if ((Math.abs(value - max) < 0.000001)) {
|
|
33
|
-
return 1;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Convert into [0, 1] range if it isn't already
|
|
37
|
-
return (value % max) / parseFloat(max);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
|
|
41
|
-
|
|
42
|
-
const toHex = function({ r, g, b }) {
|
|
43
|
-
const hexOne = function(value) {
|
|
44
|
-
value = Math.min(Math.round(value), 255);
|
|
45
|
-
const high = Math.floor(value / 16);
|
|
46
|
-
const low = value % 16;
|
|
47
|
-
return '' + (INT_HEX_MAP[high] || high) + (INT_HEX_MAP[low] || low);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
|
|
51
|
-
|
|
52
|
-
return '#' + hexOne(r) + hexOne(g) + hexOne(b);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
|
|
56
|
-
|
|
57
|
-
const parseHexChannel = function(hex) {
|
|
58
|
-
if (hex.length === 2) {
|
|
59
|
-
return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const hsl2hsv = function(hue, sat, light) {
|
|
66
|
-
sat = sat / 100;
|
|
67
|
-
light = light / 100;
|
|
68
|
-
let smin = sat;
|
|
69
|
-
const lmin = Math.max(light, 0.01);
|
|
70
|
-
let sv;
|
|
71
|
-
let v;
|
|
72
|
-
|
|
73
|
-
light *= 2;
|
|
74
|
-
sat *= (light <= 1) ? light : 2 - light;
|
|
75
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
76
|
-
v = (light + sat) / 2;
|
|
77
|
-
sv = light === 0 ? (2 * smin) / (lmin + smin) : (2 * sat) / (light + sat);
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
h: hue,
|
|
81
|
-
s: sv * 100,
|
|
82
|
-
v: v * 100
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
// `rgbToHsv`
|
|
87
|
-
// Converts an RGB color value to HSV
|
|
88
|
-
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
89
|
-
// *Returns:* { h, s, v } in [0,1]
|
|
90
|
-
const rgb2hsv = function(r, g, b) {
|
|
91
|
-
r = bound01(r, 255);
|
|
92
|
-
g = bound01(g, 255);
|
|
93
|
-
b = bound01(b, 255);
|
|
94
|
-
|
|
95
|
-
const max = Math.max(r, g, b);
|
|
96
|
-
const min = Math.min(r, g, b);
|
|
97
|
-
let h, s;
|
|
98
|
-
let v = max;
|
|
99
|
-
|
|
100
|
-
const d = max - min;
|
|
101
|
-
s = max === 0 ? 0 : d / max;
|
|
102
|
-
|
|
103
|
-
if (max === min) {
|
|
104
|
-
h = 0; // achromatic
|
|
105
|
-
} else {
|
|
106
|
-
switch (max) {
|
|
107
|
-
case r:
|
|
108
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
109
|
-
break;
|
|
110
|
-
case g:
|
|
111
|
-
h = (b - r) / d + 2;
|
|
112
|
-
break;
|
|
113
|
-
case b:
|
|
114
|
-
h = (r - g) / d + 4;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
h /= 6;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return { h: h * 360, s: s * 100, v: v * 100 };
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// `hsvToRgb`
|
|
124
|
-
// Converts an HSV color value to RGB.
|
|
125
|
-
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
126
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
127
|
-
const hsv2rgb = function(h, s, v) {
|
|
128
|
-
h = bound01(h, 360) * 6;
|
|
129
|
-
s = bound01(s, 100);
|
|
130
|
-
v = bound01(v, 100);
|
|
131
|
-
|
|
132
|
-
const i = Math.floor(h);
|
|
133
|
-
const f = h - i;
|
|
134
|
-
const p = v * (1 - s);
|
|
135
|
-
const q = v * (1 - f * s);
|
|
136
|
-
const t = v * (1 - (1 - f) * s);
|
|
137
|
-
const mod = i % 6;
|
|
138
|
-
const r = [v, q, p, p, t, v][mod];
|
|
139
|
-
const g = [t, v, v, q, p, p][mod];
|
|
140
|
-
const b = [p, p, t, v, v, q][mod];
|
|
141
|
-
|
|
142
|
-
return {
|
|
143
|
-
r: Math.round(r * 255),
|
|
144
|
-
g: Math.round(g * 255),
|
|
145
|
-
b: Math.round(b * 255)
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export default class Color {
|
|
150
|
-
constructor(options) {
|
|
151
|
-
this._hue = 0;
|
|
152
|
-
this._saturation = 100;
|
|
153
|
-
this._value = 100;
|
|
154
|
-
this._alpha = 100;
|
|
155
|
-
|
|
156
|
-
this.enableAlpha = false;
|
|
157
|
-
this.format = 'hex';
|
|
158
|
-
this.value = '';
|
|
159
|
-
|
|
160
|
-
options = options || {};
|
|
161
|
-
|
|
162
|
-
for (let option in options) {
|
|
163
|
-
if (options.hasOwnProperty(option)) {
|
|
164
|
-
this[option] = options[option];
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
this.doOnChange();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
set(prop, value) {
|
|
172
|
-
if (arguments.length === 1 && typeof prop === 'object') {
|
|
173
|
-
for (let p in prop) {
|
|
174
|
-
if (prop.hasOwnProperty(p)) {
|
|
175
|
-
this.set(p, prop[p]);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
this['_' + prop] = value;
|
|
183
|
-
this.doOnChange();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
get(prop) {
|
|
187
|
-
return this['_' + prop];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
toRgb() {
|
|
191
|
-
return hsv2rgb(this._hue, this._saturation, this._value);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
fromString(value) {
|
|
195
|
-
if (!value) {
|
|
196
|
-
this._hue = 0;
|
|
197
|
-
this._saturation = 100;
|
|
198
|
-
this._value = 100;
|
|
199
|
-
|
|
200
|
-
this.doOnChange();
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const fromHSV = (h, s, v) => {
|
|
205
|
-
this._hue = Math.max(0, Math.min(360, h));
|
|
206
|
-
this._saturation = Math.max(0, Math.min(100, s));
|
|
207
|
-
this._value = Math.max(0, Math.min(100, v));
|
|
208
|
-
|
|
209
|
-
this.doOnChange();
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
if (value.indexOf('hsl') !== -1) {
|
|
213
|
-
const parts = value.replace(/hsla|hsl|\(|\)/gm, '')
|
|
214
|
-
.split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
|
|
215
|
-
|
|
216
|
-
if (parts.length === 4) {
|
|
217
|
-
this._alpha = Math.floor(parseFloat(parts[3]) * 100);
|
|
218
|
-
} else if (parts.length === 3) {
|
|
219
|
-
this._alpha = 100;
|
|
220
|
-
}
|
|
221
|
-
if (parts.length >= 3) {
|
|
222
|
-
const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
|
|
223
|
-
fromHSV(h, s, v);
|
|
224
|
-
}
|
|
225
|
-
} else if (value.indexOf('hsv') !== -1) {
|
|
226
|
-
const parts = value.replace(/hsva|hsv|\(|\)/gm, '')
|
|
227
|
-
.split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
|
|
228
|
-
|
|
229
|
-
if (parts.length === 4) {
|
|
230
|
-
this._alpha = Math.floor(parseFloat(parts[3]) * 100);
|
|
231
|
-
} else if (parts.length === 3) {
|
|
232
|
-
this._alpha = 100;
|
|
233
|
-
}
|
|
234
|
-
if (parts.length >= 3) {
|
|
235
|
-
fromHSV(parts[0], parts[1], parts[2]);
|
|
236
|
-
}
|
|
237
|
-
} else if (value.indexOf('rgb') !== -1) {
|
|
238
|
-
const parts = value.replace(/rgba|rgb|\(|\)/gm, '')
|
|
239
|
-
.split(/\s|,/g).filter((val) => val !== '').map((val, index) => index > 2 ? parseFloat(val) : parseInt(val, 10));
|
|
240
|
-
|
|
241
|
-
if (parts.length === 4) {
|
|
242
|
-
this._alpha = Math.floor(parseFloat(parts[3]) * 100);
|
|
243
|
-
} else if (parts.length === 3) {
|
|
244
|
-
this._alpha = 100;
|
|
245
|
-
}
|
|
246
|
-
if (parts.length >= 3) {
|
|
247
|
-
const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
|
|
248
|
-
fromHSV(h, s, v);
|
|
249
|
-
}
|
|
250
|
-
} else if (value.indexOf('#') !== -1) {
|
|
251
|
-
const hex = value.replace('#', '').trim();
|
|
252
|
-
if (!/^(?:[0-9a-fA-F]{3}){1,2}$/.test(hex)) return;
|
|
253
|
-
let r, g, b;
|
|
254
|
-
|
|
255
|
-
if (hex.length === 3) {
|
|
256
|
-
r = parseHexChannel(hex[0] + hex[0]);
|
|
257
|
-
g = parseHexChannel(hex[1] + hex[1]);
|
|
258
|
-
b = parseHexChannel(hex[2] + hex[2]);
|
|
259
|
-
} else if (hex.length === 6 || hex.length === 8) {
|
|
260
|
-
r = parseHexChannel(hex.substring(0, 2));
|
|
261
|
-
g = parseHexChannel(hex.substring(2, 4));
|
|
262
|
-
b = parseHexChannel(hex.substring(4, 6));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (hex.length === 8) {
|
|
266
|
-
this._alpha = Math.floor(parseHexChannel(hex.substring(6)) / 255 * 100);
|
|
267
|
-
} else if (hex.length === 3 || hex.length === 6) {
|
|
268
|
-
this._alpha = 100;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const { h, s, v } = rgb2hsv(r, g, b);
|
|
272
|
-
fromHSV(h, s, v);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
compare(color) {
|
|
277
|
-
return Math.abs(color._hue - this._hue) < 2 &&
|
|
278
|
-
Math.abs(color._saturation - this._saturation) < 1 &&
|
|
279
|
-
Math.abs(color._value - this._value) < 1 &&
|
|
280
|
-
Math.abs(color._alpha - this._alpha) < 1;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
doOnChange() {
|
|
284
|
-
const { _hue, _saturation, _value, _alpha, format } = this;
|
|
285
|
-
|
|
286
|
-
if (this.enableAlpha) {
|
|
287
|
-
switch (format) {
|
|
288
|
-
case 'hsl':
|
|
289
|
-
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
|
290
|
-
this.value = `hsla(${ _hue }, ${ Math.round(hsl[1] * 100) }%, ${ Math.round(hsl[2] * 100) }%, ${ _alpha / 100})`;
|
|
291
|
-
break;
|
|
292
|
-
case 'hsv':
|
|
293
|
-
this.value = `hsva(${ _hue }, ${ Math.round(_saturation) }%, ${ Math.round(_value) }%, ${ _alpha / 100})`;
|
|
294
|
-
break;
|
|
295
|
-
default:
|
|
296
|
-
const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
|
|
297
|
-
this.value = `rgba(${r}, ${g}, ${b}, ${ _alpha / 100 })`;
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
switch (format) {
|
|
301
|
-
case 'hsl':
|
|
302
|
-
const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
|
303
|
-
this.value = `hsl(${ _hue }, ${ Math.round(hsl[1] * 100) }%, ${ Math.round(hsl[2] * 100) }%)`;
|
|
304
|
-
break;
|
|
305
|
-
case 'hsv':
|
|
306
|
-
this.value = `hsv(${ _hue }, ${ Math.round(_saturation) }%, ${ Math.round(_value) }%)`;
|
|
307
|
-
break;
|
|
308
|
-
case 'rgb':
|
|
309
|
-
const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
|
|
310
|
-
this.value = `rgb(${r}, ${g}, ${b})`;
|
|
311
|
-
break;
|
|
312
|
-
default:
|
|
313
|
-
this.value = toHex(hsv2rgb(_hue, _saturation, _value));
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
};
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="base-color-alpha-slider" :class="{ 'is-vertical': vertical }">
|
|
3
|
-
<div class="base-color-alpha-slider__bar"
|
|
4
|
-
@click="handleClick"
|
|
5
|
-
ref="bar"
|
|
6
|
-
:style="{
|
|
7
|
-
background: background
|
|
8
|
-
}">
|
|
9
|
-
</div>
|
|
10
|
-
<div class="base-color-alpha-slider__thumb"
|
|
11
|
-
ref="thumb"
|
|
12
|
-
:style="{
|
|
13
|
-
left: thumbLeft + 'px',
|
|
14
|
-
top: thumbTop + 'px'
|
|
15
|
-
}">
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
|
|
20
|
-
<script>
|
|
21
|
-
import draggable from '../draggable';
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
name: 'base-color-alpha-slider',
|
|
25
|
-
|
|
26
|
-
props: {
|
|
27
|
-
color: {
|
|
28
|
-
required: true
|
|
29
|
-
},
|
|
30
|
-
vertical: Boolean
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
watch: {
|
|
34
|
-
'color._alpha'() {
|
|
35
|
-
this.update();
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
'color.value'() {
|
|
39
|
-
this.update();
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
methods: {
|
|
44
|
-
handleClick(event) {
|
|
45
|
-
const thumb = this.$refs.thumb;
|
|
46
|
-
const target = event.target;
|
|
47
|
-
|
|
48
|
-
if (target !== thumb) {
|
|
49
|
-
this.handleDrag(event);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
handleDrag(event) {
|
|
54
|
-
const rect = this.$el.getBoundingClientRect();
|
|
55
|
-
const { thumb } = this.$refs;
|
|
56
|
-
|
|
57
|
-
if (!this.vertical) {
|
|
58
|
-
let left = event.clientX - rect.left;
|
|
59
|
-
left = Math.max(thumb.offsetWidth / 2, left);
|
|
60
|
-
left = Math.min(left, rect.width - thumb.offsetWidth / 2);
|
|
61
|
-
|
|
62
|
-
this.color.set('alpha', Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 100));
|
|
63
|
-
} else {
|
|
64
|
-
let top = event.clientY - rect.top;
|
|
65
|
-
top = Math.max(thumb.offsetHeight / 2, top);
|
|
66
|
-
top = Math.min(top, rect.height - thumb.offsetHeight / 2);
|
|
67
|
-
|
|
68
|
-
this.color.set('alpha', Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 100));
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
getThumbLeft() {
|
|
73
|
-
if (this.vertical) return 0;
|
|
74
|
-
const el = this.$el;
|
|
75
|
-
const alpha = this.color._alpha;
|
|
76
|
-
|
|
77
|
-
if (!el) return 0;
|
|
78
|
-
const thumb = this.$refs.thumb;
|
|
79
|
-
return Math.round(alpha * (el.offsetWidth - thumb.offsetWidth / 2) / 100);
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
getThumbTop() {
|
|
83
|
-
if (!this.vertical) return 0;
|
|
84
|
-
const el = this.$el;
|
|
85
|
-
const alpha = this.color._alpha;
|
|
86
|
-
|
|
87
|
-
if (!el) return 0;
|
|
88
|
-
const thumb = this.$refs.thumb;
|
|
89
|
-
return Math.round(alpha * (el.offsetHeight - thumb.offsetHeight / 2) / 100);
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
getBackground() {
|
|
93
|
-
if (this.color && this.color.value) {
|
|
94
|
-
const { r, g, b } = this.color.toRgb();
|
|
95
|
-
return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
update() {
|
|
101
|
-
this.thumbLeft = this.getThumbLeft();
|
|
102
|
-
this.thumbTop = this.getThumbTop();
|
|
103
|
-
this.background = this.getBackground();
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
data() {
|
|
108
|
-
return {
|
|
109
|
-
thumbLeft: 0,
|
|
110
|
-
thumbTop: 0,
|
|
111
|
-
background: null
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
|
|
115
|
-
mounted() {
|
|
116
|
-
const { bar, thumb } = this.$refs;
|
|
117
|
-
|
|
118
|
-
const dragConfig = {
|
|
119
|
-
drag: (event) => {
|
|
120
|
-
this.handleDrag(event);
|
|
121
|
-
},
|
|
122
|
-
end: (event) => {
|
|
123
|
-
this.handleDrag(event);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
draggable(bar, dragConfig);
|
|
128
|
-
draggable(thumb, dragConfig);
|
|
129
|
-
this.update();
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
</script>
|