vdesign-ui 0.2.20 → 0.3.0
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 +504 -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.umd.js +83 -83
- package/package.json +113 -113
|
@@ -1,192 +1,192 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<div class="vd-activity-views__overlay" v-if="overlay && visible" @click="handleOverlayClick"></div>
|
|
4
|
-
<transition name="vd-activity-views-slide-up">
|
|
5
|
-
<div :class="['vd-activity-views',{'vd-activity-views--safe-area-inset-bottom':safeAreaInsetBottom}]" :style="transitionStyle" v-if="visible">
|
|
6
|
-
<div class="vd-activity-views__header" v-if="withHeader">
|
|
7
|
-
<div class="vd-activity-views__wrapper">
|
|
8
|
-
<vd-icon v-if="backDefault" name="icon_nav_back"></vd-icon>
|
|
9
|
-
<div v-if="title || $slots.title" class="vd-activity-views__title">
|
|
10
|
-
<slot name="title">{{ title }}</slot>
|
|
11
|
-
</div>
|
|
12
|
-
<slot name="close">
|
|
13
|
-
<vd-icon v-if="closeIcon" class="vd-activity-views__close" :name="currentCloseIcon" svg
|
|
14
|
-
@click="onCancel"></vd-icon>
|
|
15
|
-
<vd-button v-if="closeBtn" class="vd-activity-views__done" type="primary_text" size="large"
|
|
16
|
-
@click="onCancel">{{ closeBtn }}</vd-button>
|
|
17
|
-
</slot>
|
|
18
|
-
</div>
|
|
19
|
-
<p v-if="description" class="vd-activity-views__description">{{ description }}</p>
|
|
20
|
-
</div>
|
|
21
|
-
<div v-if="withBar" class="vd-activity-views__bar"></div>
|
|
22
|
-
<div :class="['vd-activity-views__body', { 'vd-activity-views__body--action': actionSheet }]">
|
|
23
|
-
<div v-if="actionSheet" class="vd-activity-views__action">
|
|
24
|
-
<p v-if="title || $slots.title" class="vd-activity-views__action-title vd-hairline--bottom">
|
|
25
|
-
<slot name="title">{{ title }}</slot>
|
|
26
|
-
</p>
|
|
27
|
-
<div class="vd-activity-views__actions">
|
|
28
|
-
<vd-button v-for="(item, index) in actions" block size="large" :type="item.type"
|
|
29
|
-
:key="index" :class="{ 'vd-hairline--bottom': index !== actions.length - 1 }"
|
|
30
|
-
:disabled="item.disabled" @click.stop="onSelect(item)">{{ item.name }}</vd-button>
|
|
31
|
-
</div>
|
|
32
|
-
<div v-if="cancelText" class="vd-activity-views__gap"></div>
|
|
33
|
-
<div v-if="cancelText" class="vd-activity-views__cancel" @click="onCancel">
|
|
34
|
-
<vd-button block type="tertiary" size="large">{{ cancelText }}</vd-button>
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
<slot v-else></slot>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</transition>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
import { inBrowser } from '../utils/env';
|
|
46
|
-
import { themeMixin } from '../mixins/themeMixin';
|
|
47
|
-
import VdIcon from '../icon';
|
|
48
|
-
import VdButton from '../button';
|
|
49
|
-
|
|
50
|
-
export default {
|
|
51
|
-
name: 'vd-activity-views',
|
|
52
|
-
mixins: [themeMixin], // 引入混入
|
|
53
|
-
components: {
|
|
54
|
-
VdIcon,
|
|
55
|
-
VdButton
|
|
56
|
-
},
|
|
57
|
-
props: {
|
|
58
|
-
value: Boolean,
|
|
59
|
-
title: String,
|
|
60
|
-
backDefault: Boolean,
|
|
61
|
-
closeIcon: Boolean,
|
|
62
|
-
closeBtn: String,
|
|
63
|
-
description: String,
|
|
64
|
-
withHeader: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: true
|
|
67
|
-
},
|
|
68
|
-
withBar: Boolean,
|
|
69
|
-
actionSheet: Boolean,
|
|
70
|
-
actions: {
|
|
71
|
-
type: Array,
|
|
72
|
-
default() {
|
|
73
|
-
return [];
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
cancelText: String,
|
|
77
|
-
overlay: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: true
|
|
80
|
-
},
|
|
81
|
-
disabled: Boolean,
|
|
82
|
-
closeOnOverlay: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: true
|
|
85
|
-
},
|
|
86
|
-
safeAreaInsetBottom: {
|
|
87
|
-
type: Boolean,
|
|
88
|
-
default: true,
|
|
89
|
-
},
|
|
90
|
-
lockScroll: {
|
|
91
|
-
type: Boolean,
|
|
92
|
-
default: true
|
|
93
|
-
},
|
|
94
|
-
duration: {
|
|
95
|
-
type: Number,
|
|
96
|
-
},
|
|
97
|
-
// 指定挂载的容器,可以是选择器字符串或返回元素的函数
|
|
98
|
-
getContainer: {
|
|
99
|
-
type: [String, Function],
|
|
100
|
-
default: 'body',
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
data() {
|
|
104
|
-
return {
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
computed: {
|
|
108
|
-
visible() {
|
|
109
|
-
return this.value
|
|
110
|
-
},
|
|
111
|
-
currentCloseIcon() {
|
|
112
|
-
return this.isDarkTheme ? 'icon_btn_dialogclose_dark_svg' : 'icon_btn_dialogclose_svg';
|
|
113
|
-
},
|
|
114
|
-
isDarkTheme() {
|
|
115
|
-
return this.theme === 'dark';
|
|
116
|
-
},
|
|
117
|
-
// 动态设置过渡持续时间的样式
|
|
118
|
-
transitionStyle() {
|
|
119
|
-
return {
|
|
120
|
-
transitionDuration: `${this.duration}s`,
|
|
121
|
-
};
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
watch: {
|
|
125
|
-
visible(val) {
|
|
126
|
-
if (inBrowser) {
|
|
127
|
-
if (this.lockScroll) {
|
|
128
|
-
if (val) {
|
|
129
|
-
document.body.style.overflow = 'hidden';
|
|
130
|
-
} else {
|
|
131
|
-
document.body.style.overflow = '';
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
methods: {
|
|
138
|
-
closeActivity() {
|
|
139
|
-
this.$emit('input', false);
|
|
140
|
-
},
|
|
141
|
-
onCancel() {
|
|
142
|
-
this.closeActivity();
|
|
143
|
-
this.$emit('cancel');
|
|
144
|
-
},
|
|
145
|
-
onSelect(item) {
|
|
146
|
-
if (!item.disabled) {
|
|
147
|
-
this.$emit('select', item);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
handleOverlayClick() {
|
|
151
|
-
if (this.closeOnOverlay) {
|
|
152
|
-
this.closeActivity();
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
// 将弹出层添加到指定的容器中
|
|
156
|
-
appendToContainer() {
|
|
157
|
-
const container =
|
|
158
|
-
typeof this.getContainer === 'function'
|
|
159
|
-
? this.getContainer()
|
|
160
|
-
: document.querySelector(this.getContainer);
|
|
161
|
-
if (container && container !== this.$el.parentNode) {
|
|
162
|
-
container.appendChild(this.$el);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
mounted() {
|
|
167
|
-
if (inBrowser) {
|
|
168
|
-
this.appendToContainer();
|
|
169
|
-
if (this.lockScroll && this.visible) {
|
|
170
|
-
document.body.style.overflow = 'hidden';
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
beforeDestroy() {
|
|
175
|
-
if (inBrowser){
|
|
176
|
-
if(this.lockScroll) {
|
|
177
|
-
document.body.style.overflow = '';
|
|
178
|
-
}
|
|
179
|
-
// 从容器中移除弹出层元素
|
|
180
|
-
if (this.$el.parentNode) {
|
|
181
|
-
this.$el.parentNode.removeChild(this.$el);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
</script>
|
|
188
|
-
|
|
189
|
-
<style lang="less">
|
|
190
|
-
@import './style.less';
|
|
191
|
-
|
|
192
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<div class="vd-activity-views__overlay" v-if="overlay && visible" @click="handleOverlayClick"></div>
|
|
4
|
+
<transition name="vd-activity-views-slide-up">
|
|
5
|
+
<div :class="['vd-activity-views',{'vd-activity-views--safe-area-inset-bottom':safeAreaInsetBottom}]" :style="transitionStyle" v-if="visible">
|
|
6
|
+
<div class="vd-activity-views__header" v-if="withHeader">
|
|
7
|
+
<div class="vd-activity-views__wrapper">
|
|
8
|
+
<vd-icon v-if="backDefault" name="icon_nav_back"></vd-icon>
|
|
9
|
+
<div v-if="title || $slots.title" class="vd-activity-views__title">
|
|
10
|
+
<slot name="title">{{ title }}</slot>
|
|
11
|
+
</div>
|
|
12
|
+
<slot name="close">
|
|
13
|
+
<vd-icon v-if="closeIcon" class="vd-activity-views__close" :name="currentCloseIcon" svg
|
|
14
|
+
@click="onCancel"></vd-icon>
|
|
15
|
+
<vd-button v-if="closeBtn" class="vd-activity-views__done" type="primary_text" size="large"
|
|
16
|
+
@click="onCancel">{{ closeBtn }}</vd-button>
|
|
17
|
+
</slot>
|
|
18
|
+
</div>
|
|
19
|
+
<p v-if="description" class="vd-activity-views__description">{{ description }}</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-if="withBar" class="vd-activity-views__bar"></div>
|
|
22
|
+
<div :class="['vd-activity-views__body', { 'vd-activity-views__body--action': actionSheet }]">
|
|
23
|
+
<div v-if="actionSheet" class="vd-activity-views__action">
|
|
24
|
+
<p v-if="title || $slots.title" class="vd-activity-views__action-title vd-hairline--bottom">
|
|
25
|
+
<slot name="title">{{ title }}</slot>
|
|
26
|
+
</p>
|
|
27
|
+
<div class="vd-activity-views__actions">
|
|
28
|
+
<vd-button v-for="(item, index) in actions" block size="large" :type="item.type"
|
|
29
|
+
:key="index" :class="{ 'vd-hairline--bottom': index !== actions.length - 1 }"
|
|
30
|
+
:disabled="item.disabled" @click.stop="onSelect(item)">{{ item.name }}</vd-button>
|
|
31
|
+
</div>
|
|
32
|
+
<div v-if="cancelText" class="vd-activity-views__gap"></div>
|
|
33
|
+
<div v-if="cancelText" class="vd-activity-views__cancel" @click="onCancel">
|
|
34
|
+
<vd-button block type="tertiary" size="large">{{ cancelText }}</vd-button>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<slot v-else></slot>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</transition>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script>
|
|
45
|
+
import { inBrowser } from '../utils/env';
|
|
46
|
+
import { themeMixin } from '../mixins/themeMixin';
|
|
47
|
+
import VdIcon from '../icon';
|
|
48
|
+
import VdButton from '../button';
|
|
49
|
+
|
|
50
|
+
export default {
|
|
51
|
+
name: 'vd-activity-views',
|
|
52
|
+
mixins: [themeMixin], // 引入混入
|
|
53
|
+
components: {
|
|
54
|
+
VdIcon,
|
|
55
|
+
VdButton
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
value: Boolean,
|
|
59
|
+
title: String,
|
|
60
|
+
backDefault: Boolean,
|
|
61
|
+
closeIcon: Boolean,
|
|
62
|
+
closeBtn: String,
|
|
63
|
+
description: String,
|
|
64
|
+
withHeader: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
68
|
+
withBar: Boolean,
|
|
69
|
+
actionSheet: Boolean,
|
|
70
|
+
actions: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default() {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
cancelText: String,
|
|
77
|
+
overlay: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
disabled: Boolean,
|
|
82
|
+
closeOnOverlay: {
|
|
83
|
+
type: Boolean,
|
|
84
|
+
default: true
|
|
85
|
+
},
|
|
86
|
+
safeAreaInsetBottom: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: true,
|
|
89
|
+
},
|
|
90
|
+
lockScroll: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: true
|
|
93
|
+
},
|
|
94
|
+
duration: {
|
|
95
|
+
type: Number,
|
|
96
|
+
},
|
|
97
|
+
// 指定挂载的容器,可以是选择器字符串或返回元素的函数
|
|
98
|
+
getContainer: {
|
|
99
|
+
type: [String, Function],
|
|
100
|
+
default: 'body',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
computed: {
|
|
108
|
+
visible() {
|
|
109
|
+
return this.value
|
|
110
|
+
},
|
|
111
|
+
currentCloseIcon() {
|
|
112
|
+
return this.isDarkTheme ? 'icon_btn_dialogclose_dark_svg' : 'icon_btn_dialogclose_svg';
|
|
113
|
+
},
|
|
114
|
+
isDarkTheme() {
|
|
115
|
+
return this.theme === 'dark';
|
|
116
|
+
},
|
|
117
|
+
// 动态设置过渡持续时间的样式
|
|
118
|
+
transitionStyle() {
|
|
119
|
+
return {
|
|
120
|
+
transitionDuration: `${this.duration}s`,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
watch: {
|
|
125
|
+
visible(val) {
|
|
126
|
+
if (inBrowser) {
|
|
127
|
+
if (this.lockScroll) {
|
|
128
|
+
if (val) {
|
|
129
|
+
document.body.style.overflow = 'hidden';
|
|
130
|
+
} else {
|
|
131
|
+
document.body.style.overflow = '';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
closeActivity() {
|
|
139
|
+
this.$emit('input', false);
|
|
140
|
+
},
|
|
141
|
+
onCancel() {
|
|
142
|
+
this.closeActivity();
|
|
143
|
+
this.$emit('cancel');
|
|
144
|
+
},
|
|
145
|
+
onSelect(item) {
|
|
146
|
+
if (!item.disabled) {
|
|
147
|
+
this.$emit('select', item);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
handleOverlayClick() {
|
|
151
|
+
if (this.closeOnOverlay) {
|
|
152
|
+
this.closeActivity();
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
// 将弹出层添加到指定的容器中
|
|
156
|
+
appendToContainer() {
|
|
157
|
+
const container =
|
|
158
|
+
typeof this.getContainer === 'function'
|
|
159
|
+
? this.getContainer()
|
|
160
|
+
: document.querySelector(this.getContainer);
|
|
161
|
+
if (container && container !== this.$el.parentNode) {
|
|
162
|
+
container.appendChild(this.$el);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
mounted() {
|
|
167
|
+
if (inBrowser) {
|
|
168
|
+
this.appendToContainer();
|
|
169
|
+
if (this.lockScroll && this.visible) {
|
|
170
|
+
document.body.style.overflow = 'hidden';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
beforeDestroy() {
|
|
175
|
+
if (inBrowser){
|
|
176
|
+
if(this.lockScroll) {
|
|
177
|
+
document.body.style.overflow = '';
|
|
178
|
+
}
|
|
179
|
+
// 从容器中移除弹出层元素
|
|
180
|
+
if (this.$el.parentNode) {
|
|
181
|
+
this.$el.parentNode.removeChild(this.$el);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
}
|
|
187
|
+
</script>
|
|
188
|
+
|
|
189
|
+
<style lang="less">
|
|
190
|
+
@import './style.less';
|
|
191
|
+
|
|
192
|
+
</style>
|