@ecolovo/uniapp-components 1.0.10 → 2.0.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 +83 -51
- package/components/aspect/aspect.vue +24 -15
- package/components/badge/badge.scss +20 -0
- package/components/badge/badge.vue +49 -40
- package/components/button/button.scss +15 -0
- package/components/button/button.vue +121 -177
- package/components/checkbox/checkbox.scss +10 -0
- package/components/checkbox/checkbox.vue +118 -146
- package/components/checkbox-group/checkbox-group.vue +79 -85
- package/components/checkbox-group2/checkbox-group2.vue +111 -107
- package/components/checkbox-group2/checkbox2.vue +104 -0
- package/components/data-list/data-list.scss +9 -0
- package/components/data-list/data-list.vue +70 -79
- package/components/date-picker/date-picker-view.vue +125 -124
- package/components/date-picker/date-picker.vue +145 -146
- package/components/dialog/dialog-content.vue +39 -47
- package/components/dialog/dialog.scss +11 -0
- package/components/dialog/dialog.vue +125 -138
- package/components/dropdown/dropdown.scss +11 -0
- package/components/dropdown/dropdown.vue +55 -97
- package/components/empty/empty.scss +14 -0
- package/components/empty/empty.vue +42 -41
- package/components/flex/flex.vue +45 -54
- package/components/form/form.vue +29 -24
- package/components/form-item/form-item.scss +11 -0
- package/components/form-item/form-item.vue +43 -40
- package/components/icon/icon.vue +70 -85
- package/components/image/image.vue +35 -38
- package/components/input/input.vue +65 -79
- package/components/input/password-input.vue +34 -42
- package/components/list-page/list-page.vue +73 -99
- package/components/load-more/load-more.scss +12 -0
- package/components/load-more/load-more.vue +29 -29
- package/components/loading/animations/loading-animation1.vue +8 -8
- package/components/loading/animations/loading-animation2.vue +8 -9
- package/components/loading/animations/loading-animation3.vue +11 -11
- package/components/loading/animations/loading-animation4.vue +8 -8
- package/components/loading/loading.vue +19 -20
- package/components/message-box/message-box.vue +59 -41
- package/components/number-dialog/number-dialog.scss +9 -0
- package/components/number-dialog/number-dialog.vue +209 -204
- package/components/number-input/number-input.scss +9 -0
- package/components/number-input/number-input.vue +233 -232
- package/components/numpad/numpad.scss +9 -0
- package/components/numpad/numpad.vue +133 -150
- package/components/page/page-body.scss +15 -0
- package/components/page/page-body.vue +137 -119
- package/components/page/page-footer.scss +13 -0
- package/components/page/page-footer.vue +31 -33
- package/components/page/page-header.scss +17 -0
- package/components/page/page-header.vue +89 -94
- package/components/page/page.scss +9 -0
- package/components/page/page.vue +105 -81
- package/components/picker/picker-popup.vue +218 -209
- package/components/picker/picker.vue +99 -104
- package/components/popover/popover-content.vue +54 -63
- package/components/popover/popover-mask.vue +63 -63
- package/components/popover/popover.scss +28 -0
- package/components/popover/popover.vue +49 -47
- package/components/popup/popup-content.vue +49 -53
- package/components/popup/popup.scss +11 -0
- package/components/popup/popup.vue +117 -132
- package/components/price/price.scss +20 -0
- package/components/price/price.vue +31 -42
- package/components/search/search.scss +12 -0
- package/components/search/search.vue +93 -117
- package/components/searching/searching.vue +33 -40
- package/components/selector/selector.vue +43 -48
- package/components/switch/switch.scss +12 -0
- package/components/switch/switch.vue +99 -96
- package/components/tab/tab.scss +19 -0
- package/components/tab/tab.vue +151 -145
- package/components/textarea/textarea.vue +104 -101
- package/composable/component-name.ts +10 -0
- package/configs/index.ts +82 -0
- package/{easyCom.js → easyCom.ts} +1 -1
- package/index.ts +1 -0
- package/init.ts +34 -0
- package/package.json +12 -4
- package/styles/utils/css-var.scss +12 -15
- package/styles/utils/ellipsis.scss +0 -7
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +21 -245
- package/utils/{date.js → date.ts} +44 -42
- package/utils/freezeDeep.ts +9 -0
- package/utils/price.ts +57 -0
- package/utils/round.ts +11 -0
- package/utils/{windowInfo.js → windowInfo.ts} +12 -35
- package/components/checkbox-group2/checkbox.vue +0 -109
- package/components/datetime-picker/datetime-picker-view.vue +0 -209
- package/components/datetime-picker/datetime-picker.vue +0 -235
- package/components/form/mixin.js +0 -13
- package/components/list-page/list-page.js +0 -10
- package/components/table/table.vue +0 -112
- package/components/time-picker/time-picker-view.vue +0 -127
- package/components/time-picker/time-picker.vue +0 -140
- package/components/uploader/download.js +0 -81
- package/components/uploader/file-uploader.vue +0 -52
- package/components/uploader/files.js +0 -225
- package/components/uploader/media-uploader.vue +0 -189
- package/components/uploader/mixin.js +0 -171
- package/components/uploader/uni.js +0 -38
- package/components/uploader/upload-button.vue +0 -29
- package/components/uploader/uploader copy.vue +0 -547
- package/components/uploader/uploader.vue +0 -117
- package/configs/index.d.ts +0 -22
- package/configs/index.js +0 -68
- package/init.d.ts +0 -19
- package/init.js +0 -20
- package/mixins/componentName.js +0 -32
- package/mixins/listPage.js +0 -1
- package/mixins/windowInfo.js +0 -1
- package/utils/fileSize.js +0 -39
- package/utils/floor.js +0 -20
- package/utils/freezeDeep.js +0 -19
- package/utils/price.js +0 -32
- package/utils/round.js +0 -22
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
:class="[
|
|
4
|
-
|
|
4
|
+
...classNames,
|
|
5
|
+
$style['PopoverContent'],
|
|
5
6
|
$style['PopoverContent--at-' + usingPosition],
|
|
6
7
|
{
|
|
7
8
|
[$style['PopoverContent--fullscreen']]: fullscreen,
|
|
8
9
|
[$style['PopoverContent--content-initialized']]: initialized,
|
|
9
10
|
},
|
|
10
11
|
]"
|
|
11
|
-
:style="
|
|
12
|
+
:style="inlineCssVar"
|
|
12
13
|
>
|
|
13
14
|
<slot name="custom">
|
|
14
15
|
<!-- 使用自定义插槽时需要注意内容部分的尺寸,太长的内容需要手动添加 scroll-view 包裹 -->
|
|
@@ -35,78 +36,68 @@
|
|
|
35
36
|
</view>
|
|
36
37
|
</template>
|
|
37
38
|
|
|
38
|
-
<script>
|
|
39
|
-
import
|
|
40
|
-
import
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
import { ref, computed, nextTick, onMounted } from 'vue';
|
|
41
|
+
import useClassNames from '../../composable/component-name';
|
|
42
|
+
import { navBarBottomOffset, safeAreaInsetBottom } from '../../utils/windowInfo';
|
|
41
43
|
import IconCpn from '../icon/icon.vue';
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
name: 'PopoverContent',
|
|
45
|
+
defineOptions({
|
|
45
46
|
options: {
|
|
46
47
|
virtualHost: true,
|
|
47
48
|
styleIsolation: 'shared',
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
/** 是否显示 loading 动画 */
|
|
63
|
-
loading: {
|
|
64
|
-
type: Boolean,
|
|
65
|
-
default: false,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
data() {
|
|
69
|
-
return {
|
|
70
|
-
/**
|
|
71
|
-
* 弹出框是否已初始化
|
|
72
|
-
* - 由于计算属性 usingPosition 在模拟器上会使动画显示不正常(计算属性计算滞后),
|
|
73
|
-
* 故添加此标识在初始化完成前不作任何动画
|
|
74
|
-
*/
|
|
75
|
-
initialized: false,
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
computed: {
|
|
79
|
-
/** 计算后的位置值 */
|
|
80
|
-
usingPosition() {
|
|
81
|
-
return ['top', 'bottom', 'left', 'right', 'center'].includes(this.position) ? this.position : 'bottom';
|
|
82
|
-
},
|
|
83
|
-
styleStr() {
|
|
84
|
-
return [
|
|
85
|
-
`--header-bar-bottom: ${this.navBarBottomOffset}px;`,
|
|
86
|
-
`--safe-area-bottom: ${this.safeAreaInsetBottom}px;`,
|
|
87
|
-
].join(' ');
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
mounted() {
|
|
91
|
-
this.$nextTick(() => {
|
|
92
|
-
this.initialized = true;
|
|
93
|
-
});
|
|
94
|
-
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const classNames = useClassNames('popover-content');
|
|
53
|
+
|
|
54
|
+
type _Props = {
|
|
55
|
+
/** 弹出框位置,可选值为 top、bottom、left、right、center */
|
|
56
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
57
|
+
/** 是否占满屏幕 */
|
|
58
|
+
fullscreen?: boolean;
|
|
59
|
+
/** 是否显示 loading 动画 */
|
|
60
|
+
loading?: boolean;
|
|
95
61
|
};
|
|
62
|
+
|
|
63
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
64
|
+
position: 'center',
|
|
65
|
+
fullscreen: false,
|
|
66
|
+
loading: false,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 弹出框是否已初始化
|
|
71
|
+
* - 由于计算属性 usingPosition 在模拟器上会使动画显示不正常(计算属性计算滞后),
|
|
72
|
+
* 故添加此标识在初始化完成前不作任何动画
|
|
73
|
+
*/
|
|
74
|
+
const initialized = ref(false);
|
|
75
|
+
|
|
76
|
+
/** 计算后的位置值 */
|
|
77
|
+
const usingPosition = computed(() => {
|
|
78
|
+
return ['top', 'bottom', 'left', 'right', 'center'].includes(props.position) ? props.position : 'center';
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const inlineCssVar = computed(() => {
|
|
82
|
+
return [`--page-header-bottom: ${navBarBottomOffset}px;`, `--safe-area-bottom: ${safeAreaInsetBottom}px;`].join(
|
|
83
|
+
' '
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
onMounted(() => {
|
|
88
|
+
nextTick(() => {
|
|
89
|
+
initialized.value = true;
|
|
90
|
+
});
|
|
91
|
+
});
|
|
96
92
|
</script>
|
|
97
93
|
|
|
98
94
|
<style lang="scss" module>
|
|
99
|
-
@use '../../styles/
|
|
95
|
+
@use '../../styles/utils' as *;
|
|
96
|
+
@use './popover' as *;
|
|
100
97
|
|
|
101
98
|
// 定义外部变量
|
|
102
|
-
$component-name: 'popover';
|
|
103
|
-
$component-vars: $popover;
|
|
104
99
|
%external-vars {
|
|
105
|
-
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
:host {
|
|
109
|
-
display: block;
|
|
100
|
+
@include UTILS__DEFINE_COMPONENT_VARS($popover, 'popover');
|
|
110
101
|
}
|
|
111
102
|
|
|
112
103
|
.PopoverContent {
|
|
@@ -195,8 +186,8 @@ $component-vars: $popover;
|
|
|
195
186
|
}
|
|
196
187
|
// 顶部安全区域
|
|
197
188
|
@at-root %safe-top #{UTILS__LAST_SELECTOR(&)} {
|
|
198
|
-
padding-top: var(--header-
|
|
199
|
-
--safe-top-padding: var(--header-
|
|
189
|
+
padding-top: var(--page-header-bottom);
|
|
190
|
+
--safe-top-padding: var(--page-header-bottom);
|
|
200
191
|
}
|
|
201
192
|
// 底部安全区域
|
|
202
193
|
@at-root %safe-bottom #{UTILS__LAST_SELECTOR(&)} {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
:class="[
|
|
4
|
-
|
|
4
|
+
...classNames,
|
|
5
|
+
$style['PopoverMask'],
|
|
5
6
|
{ [$style['PopoverMask--visible']]: isVisible, 'PopoverMask--visible': isVisible },
|
|
6
7
|
]"
|
|
7
|
-
@touchmove.stop.prevent
|
|
8
|
+
@touchmove.stop.prevent
|
|
8
9
|
>
|
|
9
|
-
<!-- 遮罩层 -->
|
|
10
10
|
<view
|
|
11
11
|
:class="[$style['PopoverMask--mask'], { [$style['PopoverMask--animated']]: isInitialized }]"
|
|
12
12
|
@click="onMask()"
|
|
@@ -16,84 +16,84 @@
|
|
|
16
16
|
</view>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
|
-
<script>
|
|
20
|
-
import
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { ref, nextTick, onMounted } from 'vue';
|
|
21
|
+
import useClassNames from '../../composable/component-name';
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
name: 'PopoverMask',
|
|
23
|
+
defineOptions({
|
|
24
24
|
options: {
|
|
25
25
|
virtualHost: true,
|
|
26
26
|
styleIsolation: 'shared',
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}, 300);
|
|
73
|
-
},
|
|
74
|
-
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const classNames = useClassNames('popover-mask');
|
|
31
|
+
|
|
32
|
+
type _Props = {
|
|
33
|
+
/** v-model 绑定值,控制弹出框是否可见 */
|
|
34
|
+
modelValue?: boolean;
|
|
35
|
+
/** 是否模态弹出框 */
|
|
36
|
+
modal?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
40
|
+
modelValue: false,
|
|
41
|
+
modal: false,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const emit = defineEmits<{
|
|
45
|
+
(e: 'update:modelValue', val: boolean): void;
|
|
46
|
+
(e: 'close'): void;
|
|
47
|
+
(e: 'closed'): void;
|
|
48
|
+
}>();
|
|
49
|
+
|
|
50
|
+
/** 弹出框是否可见 */
|
|
51
|
+
const isVisible = ref(false);
|
|
52
|
+
/** 控制是否有动画,其实没必要,只是在模拟器上显示不正常 */
|
|
53
|
+
const isInitialized = ref(false);
|
|
54
|
+
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
nextTick(() => {
|
|
57
|
+
isVisible.value = true;
|
|
58
|
+
isInitialized.value = true;
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
/** 关闭弹出框 */
|
|
63
|
+
const close = (onClosed?: VoidFunction) => {
|
|
64
|
+
emit('close');
|
|
65
|
+
isVisible.value = false;
|
|
66
|
+
|
|
67
|
+
setTimeout(() => {
|
|
68
|
+
onClosed?.();
|
|
69
|
+
emit('update:modelValue', false);
|
|
70
|
+
emit('closed');
|
|
71
|
+
}, 300);
|
|
75
72
|
};
|
|
73
|
+
|
|
74
|
+
/** 点击遮罩层 */
|
|
75
|
+
const onMask = () => {
|
|
76
|
+
if (props.modal) return;
|
|
77
|
+
close();
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
defineExpose({ close });
|
|
76
81
|
</script>
|
|
77
82
|
|
|
78
83
|
<style lang="scss" module>
|
|
79
|
-
@use '../../styles/
|
|
84
|
+
@use '../../styles/utils' as *;
|
|
85
|
+
@use './popover' as *;
|
|
80
86
|
|
|
81
87
|
// 定义外部变量
|
|
82
|
-
$component-name: 'popover';
|
|
83
|
-
$component-vars: $popover;
|
|
84
88
|
%external-vars {
|
|
85
|
-
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
:host {
|
|
89
|
-
display: block;
|
|
89
|
+
@include UTILS__DEFINE_COMPONENT_VARS($popover, 'popover');
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
.PopoverMask {
|
|
93
93
|
@extend %external-vars;
|
|
94
94
|
position: fixed;
|
|
95
95
|
inset: 0;
|
|
96
|
-
z-index: UTILS__z-index();
|
|
96
|
+
z-index: UTILS__z-index('popover');
|
|
97
97
|
|
|
98
98
|
// 遮罩层
|
|
99
99
|
.PopoverMask--mask {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../styles/utils' as *;
|
|
3
|
+
|
|
4
|
+
// 可配置的变量
|
|
5
|
+
$popover: () !default;
|
|
6
|
+
$popover-default: (
|
|
7
|
+
// 遮罩层颜色
|
|
8
|
+
mask-color: #00000080,
|
|
9
|
+
// 背景色
|
|
10
|
+
background: #fff,
|
|
11
|
+
// 位置,position 为 center 时有效
|
|
12
|
+
position: 50% auto auto 50%,
|
|
13
|
+
// 宽度,position 为 left 、 right 或 center 时有效
|
|
14
|
+
width: 80vw,
|
|
15
|
+
// 最小高度,position 为 top 、 bottom 或 center 时有效
|
|
16
|
+
min-height: 0px,
|
|
17
|
+
// 最大高度,position 为 top 、 bottom 或 center 时有效
|
|
18
|
+
max-height: 75vh,
|
|
19
|
+
// 内边距
|
|
20
|
+
padding: 20rpx,
|
|
21
|
+
// 边框圆角
|
|
22
|
+
radius: 20rpx,
|
|
23
|
+
// 头高度
|
|
24
|
+
header-height: 0px,
|
|
25
|
+
// 尾高度
|
|
26
|
+
footer-height: 0px
|
|
27
|
+
);
|
|
28
|
+
$popover: map.merge($popover-default, $popover);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames, $style['Popover']]">
|
|
3
3
|
<popover-mask-cpn
|
|
4
|
-
v-if="
|
|
5
|
-
ref="
|
|
6
|
-
:value="
|
|
4
|
+
v-if="modelValue"
|
|
5
|
+
ref="maskRef"
|
|
6
|
+
:model-value="modelValue"
|
|
7
7
|
:modal="modal || loading"
|
|
8
|
-
@
|
|
8
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
9
9
|
@close="$emit('close')"
|
|
10
10
|
@closed="$emit('closed')"
|
|
11
11
|
>
|
|
@@ -29,54 +29,56 @@
|
|
|
29
29
|
</view>
|
|
30
30
|
</template>
|
|
31
31
|
|
|
32
|
-
<script>
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
32
|
+
<script lang="ts" setup>
|
|
33
|
+
import { ref } from 'vue';
|
|
34
|
+
import useClassNames from '../../composable/component-name';
|
|
35
|
+
import PopoverContentCpn from './popover-content.vue';
|
|
36
|
+
import PopoverMaskCpn from './popover-mask.vue';
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
name: 'Popover',
|
|
38
|
+
defineOptions({
|
|
40
39
|
options: {
|
|
41
40
|
virtualHost: true,
|
|
42
41
|
styleIsolation: 'shared',
|
|
43
42
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const classNames = useClassNames('popover');
|
|
46
|
+
|
|
47
|
+
type _Props = {
|
|
48
|
+
/** v-model 绑定值,控制弹出框是否可见 */
|
|
49
|
+
modelValue?: boolean;
|
|
50
|
+
/** 弹出框位置,可选值为 top、bottom、left、right、center */
|
|
51
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
52
|
+
/** 是否占满屏幕 */
|
|
53
|
+
fullscreen?: boolean;
|
|
54
|
+
/** 是否模态弹出框 */
|
|
55
|
+
modal?: boolean;
|
|
56
|
+
/** 是否显示 loading 动画 */
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
withDefaults(defineProps<_Props>(), {
|
|
61
|
+
modelValue: false,
|
|
62
|
+
position: 'bottom',
|
|
63
|
+
fullscreen: false,
|
|
64
|
+
modal: false,
|
|
65
|
+
loading: false,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
defineEmits<{
|
|
69
|
+
(e: 'update:modelValue', val: boolean): void;
|
|
70
|
+
(e: 'close'): void;
|
|
71
|
+
(e: 'closed'): void;
|
|
72
|
+
}>();
|
|
73
|
+
|
|
74
|
+
const maskRef = ref<InstanceType<typeof PopoverMaskCpn>>();
|
|
75
|
+
|
|
76
|
+
/** 关闭弹出框 */
|
|
77
|
+
const close = (onClosed?: VoidFunction) => {
|
|
78
|
+
maskRef.value?.close(onClosed);
|
|
79
79
|
};
|
|
80
|
+
|
|
81
|
+
defineExpose({ close });
|
|
80
82
|
</script>
|
|
81
83
|
|
|
82
84
|
<style lang="scss" module>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames, $style['PopupContent']]">
|
|
3
3
|
<popover-content-cpn position="bottom" :loading="loading">
|
|
4
4
|
<!-- 内容上方标题 -->
|
|
5
5
|
<template #header>
|
|
@@ -29,14 +29,18 @@
|
|
|
29
29
|
<slot v-if="$slots.footer" name="footer"></slot>
|
|
30
30
|
<view v-else-if="cancel || confirm" :class="$style['PopupContent--footer']">
|
|
31
31
|
<view v-if="cancel" :class="$style['PopupContent--button']">
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
<slot name="cancel">
|
|
33
|
+
<button-cpn plain @click="$emit('cancel')">
|
|
34
|
+
{{ cancel }}
|
|
35
|
+
</button-cpn>
|
|
36
|
+
</slot>
|
|
35
37
|
</view>
|
|
36
38
|
<view v-if="confirm" :class="$style['PopupContent--button']">
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
<slot name="confirm">
|
|
40
|
+
<button-cpn @click="$emit('confirm')">
|
|
41
|
+
{{ confirm }}
|
|
42
|
+
</button-cpn>
|
|
43
|
+
</slot>
|
|
40
44
|
</view>
|
|
41
45
|
</view>
|
|
42
46
|
</template>
|
|
@@ -44,67 +48,59 @@
|
|
|
44
48
|
</view>
|
|
45
49
|
</template>
|
|
46
50
|
|
|
47
|
-
<script>
|
|
48
|
-
import
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import useClassNames from '../../composable/component-name';
|
|
49
53
|
import ButtonCpn from '../button/button.vue';
|
|
50
54
|
import IconCpn from '../icon/icon.vue';
|
|
51
55
|
import PopoverContentCpn from '../popover/popover-content.vue';
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
name: 'PopupContent',
|
|
57
|
+
defineOptions({
|
|
55
58
|
options: {
|
|
56
59
|
virtualHost: true,
|
|
57
60
|
styleIsolation: 'shared',
|
|
58
61
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
/** 是否显示关闭按钮 */
|
|
78
|
-
showClose: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: true,
|
|
81
|
-
},
|
|
82
|
-
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
83
|
-
cancel: {
|
|
84
|
-
type: [String, Boolean],
|
|
85
|
-
default: '取消',
|
|
86
|
-
},
|
|
87
|
-
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
88
|
-
confirm: {
|
|
89
|
-
type: [String, Boolean],
|
|
90
|
-
default: '确认',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const classNames = useClassNames('popup-content');
|
|
65
|
+
|
|
66
|
+
type _Props = {
|
|
67
|
+
/** 是否显示 loading 动画 */
|
|
68
|
+
loading?: boolean;
|
|
69
|
+
/** 标题 */
|
|
70
|
+
title?: string;
|
|
71
|
+
/** 是否居中标题 */
|
|
72
|
+
centerTitle?: boolean;
|
|
73
|
+
/** 是否显示关闭按钮 */
|
|
74
|
+
showClose?: boolean;
|
|
75
|
+
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
76
|
+
cancel?: string | boolean;
|
|
77
|
+
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
78
|
+
confirm?: string | boolean;
|
|
93
79
|
};
|
|
80
|
+
|
|
81
|
+
withDefaults(defineProps<_Props>(), {
|
|
82
|
+
loading: false,
|
|
83
|
+
title: '',
|
|
84
|
+
centerTitle: false,
|
|
85
|
+
showClose: true,
|
|
86
|
+
cancel: '取消',
|
|
87
|
+
confirm: '确认',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
defineEmits<{
|
|
91
|
+
(e: 'close'): void;
|
|
92
|
+
(e: 'cancel'): void;
|
|
93
|
+
(e: 'confirm'): void;
|
|
94
|
+
}>();
|
|
94
95
|
</script>
|
|
95
96
|
|
|
96
97
|
<style lang="scss" module>
|
|
97
|
-
@use '../../styles/
|
|
98
|
+
@use '../../styles/utils' as *;
|
|
99
|
+
@use './popup' as *;
|
|
98
100
|
|
|
99
101
|
// 定义外部变量
|
|
100
|
-
$component-name: 'popup';
|
|
101
|
-
$component-vars: $popup;
|
|
102
102
|
%external-vars {
|
|
103
|
-
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
:host {
|
|
107
|
-
display: block;
|
|
103
|
+
@include UTILS__DEFINE_COMPONENT_VARS($popup, 'popup');
|
|
108
104
|
}
|
|
109
105
|
|
|
110
106
|
.PopupContent {
|