@ecolovo/uniapp-components 1.0.9 → 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 +125 -181
- package/components/checkbox/checkbox.scss +10 -0
- package/components/checkbox/checkbox.vue +118 -146
- package/components/checkbox-group/checkbox-group.vue +79 -81
- 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 -179
- 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
package/components/flex/flex.vue
CHANGED
|
@@ -1,68 +1,59 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames, $style['Flex']]" :style="flexStyle">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script>
|
|
8
|
-
import
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed } from 'vue';
|
|
9
|
+
import useClassNames from '../../composable/component-name';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
name: 'Flex',
|
|
11
|
+
defineOptions({
|
|
12
12
|
options: {
|
|
13
13
|
virtualHost: true,
|
|
14
14
|
styleIsolation: 'shared',
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** 交叉轴对齐方式 */
|
|
32
|
-
align: {
|
|
33
|
-
type: String,
|
|
34
|
-
Validator: (value) => ['start', 'center', 'end', 'baseline', 'stretch'].includes(value),
|
|
35
|
-
default: 'center',
|
|
36
|
-
},
|
|
37
|
-
/** 是否换行 */
|
|
38
|
-
wrap: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
/** 间距 */
|
|
43
|
-
gap: {
|
|
44
|
-
type: [String, Number, Array],
|
|
45
|
-
default: '0px',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
computed: {
|
|
49
|
-
gapValue() {
|
|
50
|
-
if (Array.isArray(this.gap)) {
|
|
51
|
-
return this.gap.map((item) => (typeof item === 'number' ? uni.upx2px(item) + 'px' : item)).join(' ');
|
|
52
|
-
}
|
|
53
|
-
return typeof this.gap === 'number' ? uni.upx2px(this.gap) + 'px' : this.gap;
|
|
54
|
-
},
|
|
55
|
-
styleStr() {
|
|
56
|
-
return [
|
|
57
|
-
`flex-direction: ${this.direction};`,
|
|
58
|
-
`justify-content: ${this.justify};`,
|
|
59
|
-
`align-items: ${this.align};`,
|
|
60
|
-
`flex-wrap: ${this.wrap ? 'wrap' : 'nowrap'};`,
|
|
61
|
-
`gap: ${this.gapValue};`,
|
|
62
|
-
].join(' ');
|
|
63
|
-
},
|
|
64
|
-
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const classNames = useClassNames('flex');
|
|
19
|
+
|
|
20
|
+
type _Props = {
|
|
21
|
+
/** 排版方向 */
|
|
22
|
+
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
23
|
+
/** 当前轴对齐方式 */
|
|
24
|
+
justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
25
|
+
/** 交叉轴对齐方式 */
|
|
26
|
+
align?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
27
|
+
/** 是否换行 */
|
|
28
|
+
wrap?: boolean;
|
|
29
|
+
/** 间距 */
|
|
30
|
+
gap?: string | number | (string | number)[];
|
|
65
31
|
};
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
34
|
+
direction: 'row',
|
|
35
|
+
justify: 'start',
|
|
36
|
+
align: 'center',
|
|
37
|
+
wrap: false,
|
|
38
|
+
gap: '0px',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const gapValue = computed(() => {
|
|
42
|
+
if (Array.isArray(props.gap)) {
|
|
43
|
+
return props.gap.map((item) => (typeof item === 'number' ? uni.upx2px(item) + 'px' : item)).join(' ');
|
|
44
|
+
}
|
|
45
|
+
return typeof props.gap === 'number' ? uni.upx2px(props.gap) + 'px' : props.gap;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const flexStyle = computed(() => {
|
|
49
|
+
return [
|
|
50
|
+
`flex-direction: ${props.direction};`,
|
|
51
|
+
`justify-content: ${props.justify};`,
|
|
52
|
+
`align-items: ${props.align};`,
|
|
53
|
+
`flex-wrap: ${props.wrap ? 'wrap' : 'nowrap'};`,
|
|
54
|
+
`gap: ${gapValue.value};`,
|
|
55
|
+
].join('');
|
|
56
|
+
});
|
|
66
57
|
</script>
|
|
67
58
|
|
|
68
59
|
<style lang="scss" module>
|
package/components/form/form.vue
CHANGED
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames]">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
-
<script>
|
|
8
|
-
import
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed, provide } from 'vue';
|
|
9
|
+
import useClassNames from '../../composable/component-name';
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
name: 'Form',
|
|
11
|
+
defineOptions({
|
|
12
12
|
options: {
|
|
13
|
-
virtualHost: true,
|
|
14
13
|
styleIsolation: 'shared',
|
|
14
|
+
virtualHost: true,
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
default: false,
|
|
26
|
-
},
|
|
27
|
-
/** 显示类型 */
|
|
28
|
-
type: {
|
|
29
|
-
type: String,
|
|
30
|
-
validator: (val) => !val || ['line', 'next', 'block'].includes(val),
|
|
31
|
-
default: 'line',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const classNames = useClassNames('form');
|
|
19
|
+
|
|
20
|
+
type _Props = {
|
|
21
|
+
/** 是否只读 */
|
|
22
|
+
readonly?: boolean;
|
|
23
|
+
/** 表单显示类型 */
|
|
24
|
+
type?: 'line' | 'next' | 'block';
|
|
34
25
|
};
|
|
26
|
+
|
|
27
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
28
|
+
readonly: false,
|
|
29
|
+
type: 'line',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
provide(
|
|
33
|
+
'ecolovo/form/readonly',
|
|
34
|
+
computed(() => props.readonly)
|
|
35
|
+
);
|
|
36
|
+
provide(
|
|
37
|
+
'ecolovo/form/type',
|
|
38
|
+
computed(() => props.type)
|
|
39
|
+
);
|
|
35
40
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
:class="[
|
|
4
|
-
|
|
4
|
+
...classNames,
|
|
5
|
+
$style['FormItem'],
|
|
5
6
|
{
|
|
6
7
|
[$style['FormItem--line']]: usingType === 'line',
|
|
7
8
|
[$style['FormItem--next']]: usingType === 'next',
|
|
@@ -19,56 +20,58 @@
|
|
|
19
20
|
</view>
|
|
20
21
|
</template>
|
|
21
22
|
|
|
22
|
-
<script>
|
|
23
|
-
import
|
|
24
|
-
import
|
|
23
|
+
<script lang="ts" setup>
|
|
24
|
+
import { computed, ComputedRef, inject } from 'vue';
|
|
25
|
+
import useClassNames from '../../composable/component-name';
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
name: 'FormItem',
|
|
27
|
+
defineOptions({
|
|
28
28
|
options: {
|
|
29
29
|
virtualHost: true,
|
|
30
30
|
styleIsolation: 'shared',
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
required: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: false,
|
|
48
|
-
},
|
|
49
|
-
/** 显示类型 */
|
|
50
|
-
type: {
|
|
51
|
-
type: String,
|
|
52
|
-
validator: (val) => !val || ['line', 'next', 'block'].includes(val),
|
|
53
|
-
default: '',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
computed: {
|
|
57
|
-
usingType() {
|
|
58
|
-
return this.type || this.formProps.type || 'line';
|
|
59
|
-
},
|
|
60
|
-
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const classNames = useClassNames('form-item');
|
|
35
|
+
|
|
36
|
+
type _Props = {
|
|
37
|
+
/** 标签文本 */
|
|
38
|
+
label?: string;
|
|
39
|
+
/** 副标签文本 */
|
|
40
|
+
subLabel?: string;
|
|
41
|
+
/** 是否必填 */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
/** 显示类型 */
|
|
44
|
+
type?: 'line' | 'next' | 'block';
|
|
61
45
|
};
|
|
46
|
+
|
|
47
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
48
|
+
label: '',
|
|
49
|
+
subLabel: '',
|
|
50
|
+
required: false,
|
|
51
|
+
type: undefined,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/** 表单是否只读 */
|
|
55
|
+
const isFormReadonly = inject<ComputedRef<boolean>>(
|
|
56
|
+
'ecolovo/form/readonly',
|
|
57
|
+
computed(() => false)
|
|
58
|
+
);
|
|
59
|
+
/** 表单显示类型 */
|
|
60
|
+
const formType = inject<ComputedRef<'line' | 'next' | 'block'>>(
|
|
61
|
+
'ecolovo/form/type',
|
|
62
|
+
computed<'line' | 'next' | 'block'>(() => 'line')
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
/** 显示类型 */
|
|
66
|
+
const usingType = computed(() => props.type || formType.value);
|
|
62
67
|
</script>
|
|
63
68
|
|
|
64
69
|
<style lang="scss" module>
|
|
65
|
-
@use '../../styles/
|
|
70
|
+
@use '../../styles/utils' as *;
|
|
71
|
+
@use './form-item' as *;
|
|
66
72
|
|
|
67
|
-
// 定义外部变量
|
|
68
|
-
$component-name: 'form-item';
|
|
69
|
-
$component-vars: $form-item;
|
|
70
73
|
%external-vars {
|
|
71
|
-
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
74
|
+
@include UTILS__DEFINE_COMPONENT_VARS($form-item, 'form-item');
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
.FormItem {
|
package/components/icon/icon.vue
CHANGED
|
@@ -1,108 +1,93 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<text
|
|
3
|
-
:class="[
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
:class="[
|
|
4
|
+
...classNames,
|
|
5
|
+
...iconClass,
|
|
6
|
+
$style['Icon'],
|
|
7
|
+
{
|
|
8
|
+
[$style['Icon--spinning']]: spinning,
|
|
9
|
+
},
|
|
10
|
+
]"
|
|
11
|
+
></text>
|
|
8
12
|
</template>
|
|
9
13
|
|
|
10
|
-
<script>
|
|
11
|
-
import
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { computed } from 'vue';
|
|
16
|
+
import useClassNames from '../../composable/component-name';
|
|
12
17
|
import { iconMap } from '../../configs';
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export default {
|
|
17
|
-
name: 'Icon',
|
|
19
|
+
defineOptions({
|
|
18
20
|
options: {
|
|
19
|
-
virtualHost: true,
|
|
20
21
|
styleIsolation: 'shared',
|
|
22
|
+
virtualHost: true,
|
|
21
23
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type: String,
|
|
32
|
-
default: '',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
computed: {
|
|
36
|
-
iconClass() {
|
|
37
|
-
const iconInfo = iconMap.get(this.icon);
|
|
38
|
-
if (!iconInfo) {
|
|
39
|
-
/* eslint-disable no-console */
|
|
40
|
-
console.error(`${this.componentClass} Error: 找不到图标 "${this.icon}"`);
|
|
41
|
-
if (process.env.NODE_ENV === 'development') {
|
|
42
|
-
console.groupCollapsed(`%c查看解决方法`, 'color: orange');
|
|
43
|
-
console.warn(
|
|
44
|
-
[
|
|
45
|
-
'请检查是否在 `main.js` 文件中调用了组件库的 `init` 方法,并传入了图标文件的 json 文件',
|
|
46
|
-
'例:',
|
|
47
|
-
'```',
|
|
48
|
-
'// main.js',
|
|
49
|
-
"import init from '@ecolovo/uniapp-components/init';",
|
|
50
|
-
"init({ iconfont: require('@/resources/iconfont/some_icon/iconfont.json') });",
|
|
51
|
-
'\n// App.vue -> <style>',
|
|
52
|
-
"@import '@/resources/iconfont/iconfont.css';",
|
|
53
|
-
'```',
|
|
54
|
-
`\n当前可用图标: `,
|
|
55
|
-
iconListStr,
|
|
56
|
-
].join('\n')
|
|
57
|
-
);
|
|
58
|
-
console.groupEnd();
|
|
59
|
-
}
|
|
60
|
-
/* eslint-enable no-console */
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
return [iconInfo.fontFamily, iconInfo.prefix + iconInfo.name];
|
|
64
|
-
},
|
|
65
|
-
loadingAnimation() {
|
|
66
|
-
return /(?<![a-zA-Z])loading(?![a-zA-Z])/.test(this.icon) ? this.$style['Icon--spinner'] : '';
|
|
67
|
-
},
|
|
68
|
-
styleStr() {
|
|
69
|
-
return `--tap-size: ${this.tapSize || '100%'};`;
|
|
70
|
-
},
|
|
71
|
-
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const classNames = useClassNames('icon');
|
|
27
|
+
|
|
28
|
+
type _Props = {
|
|
29
|
+
/** 图标名 */
|
|
30
|
+
icon: string;
|
|
31
|
+
/** 旋转动画 */
|
|
32
|
+
spinning?: boolean;
|
|
72
33
|
};
|
|
34
|
+
|
|
35
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
36
|
+
spinning: false,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const iconEntry = computed(() => {
|
|
40
|
+
/* eslint-disable no-console */
|
|
41
|
+
if (!props.icon) console.error('icon 不能为空');
|
|
42
|
+
|
|
43
|
+
const icon = iconMap.get(props.icon);
|
|
44
|
+
|
|
45
|
+
if (!icon) {
|
|
46
|
+
console.error(`${classNames[0]}: 找不到图标 "${props.icon}"`);
|
|
47
|
+
if (import.meta.env.DEV) {
|
|
48
|
+
console.groupCollapsed(`%c查看解决方法`, 'color: orange');
|
|
49
|
+
console.warn(
|
|
50
|
+
[
|
|
51
|
+
'请检查是否在 `main.ts` 文件中调用了组件库的 `init` 方法,并传入了图标文件的 json 文件',
|
|
52
|
+
'例:',
|
|
53
|
+
'```',
|
|
54
|
+
'// main.js',
|
|
55
|
+
"import { init } from '@ecolovo/uniapp-components';",
|
|
56
|
+
"import iconJson from '@/resources/iconfont/some_icon/iconfont.json';",
|
|
57
|
+
'init({ iconfont: iconJson });',
|
|
58
|
+
'\n// App.vue -> <style>',
|
|
59
|
+
"@import '@/resources/iconfont/iconfont.css';",
|
|
60
|
+
'```',
|
|
61
|
+
`\n当前可用的图标列表: `,
|
|
62
|
+
[...iconMap.keys()].join('\n'),
|
|
63
|
+
].join('\n')
|
|
64
|
+
);
|
|
65
|
+
console.groupEnd();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return icon;
|
|
70
|
+
/* eslint-enable no-console */
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const iconClass = computed(() =>
|
|
74
|
+
iconEntry.value ? [iconEntry.value.fontFamily, iconEntry.value.prefix + iconEntry.value.name] : []
|
|
75
|
+
);
|
|
73
76
|
</script>
|
|
74
77
|
|
|
75
78
|
<style lang="scss">
|
|
76
79
|
@import '../../resources/iconfont/uniapp_ui_icon/iconfont.css';
|
|
77
|
-
|
|
78
|
-
.uniapp_ui_icon {
|
|
79
|
-
font-size: inherit;
|
|
80
|
-
line-height: inherit;
|
|
81
|
-
}
|
|
82
80
|
</style>
|
|
83
|
-
|
|
84
81
|
<style lang="scss" module>
|
|
85
82
|
.Icon {
|
|
86
|
-
display: inline-block;
|
|
87
83
|
font-size: inherit;
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
.Icon--expand-tap-size {
|
|
91
|
-
position: relative;
|
|
92
|
-
&::after {
|
|
93
|
-
content: '';
|
|
94
|
-
position: absolute;
|
|
95
|
-
top: 50%;
|
|
96
|
-
left: 50%;
|
|
97
|
-
width: var(--tap-size, 100%);
|
|
98
|
-
height: var(--tap-size, 100%);
|
|
99
|
-
transform: translate(-50%, -50%);
|
|
100
|
-
}
|
|
84
|
+
line-height: inherit;
|
|
101
85
|
}
|
|
102
|
-
.Icon--
|
|
103
|
-
|
|
86
|
+
.Icon--spinning {
|
|
87
|
+
display: inline-block;
|
|
88
|
+
animation: Icon--circle var(--animation-duration, 0.75s) linear infinite;
|
|
104
89
|
|
|
105
|
-
@keyframes circle {
|
|
90
|
+
@keyframes Icon--circle {
|
|
106
91
|
0% {
|
|
107
92
|
rotate: 0deg;
|
|
108
93
|
}
|
|
@@ -2,54 +2,51 @@
|
|
|
2
2
|
<image
|
|
3
3
|
:src="src || ''"
|
|
4
4
|
:preview-list="previewList"
|
|
5
|
-
:class="
|
|
5
|
+
:class="[...classNames, $style['Image']]"
|
|
6
6
|
:mode="mode"
|
|
7
7
|
@click="preview"
|
|
8
8
|
></image>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
|
-
<script>
|
|
12
|
-
import
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import useClassNames from '../../composable/component-name';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
name: 'Image',
|
|
14
|
+
defineOptions({
|
|
16
15
|
options: {
|
|
17
16
|
virtualHost: true,
|
|
18
17
|
styleIsolation: 'shared',
|
|
19
18
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const classNames = useClassNames('image');
|
|
22
|
+
|
|
23
|
+
type _Props = {
|
|
24
|
+
/** 图片地址 */
|
|
25
|
+
src?: string;
|
|
26
|
+
/** 图片显示模式 */
|
|
27
|
+
mode?: string;
|
|
28
|
+
/** 预览列表 */
|
|
29
|
+
previewList?: string[];
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
33
|
+
src: '',
|
|
34
|
+
mode: '',
|
|
35
|
+
previewList: () => [],
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const preview = () => {
|
|
39
|
+
if (props.previewList.length > 0) {
|
|
40
|
+
uni.previewImage({
|
|
41
|
+
current: props.src,
|
|
42
|
+
urls: props.previewList,
|
|
43
|
+
});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
uni.previewImage({
|
|
47
|
+
current: props.src,
|
|
48
|
+
urls: [props.src],
|
|
49
|
+
});
|
|
53
50
|
};
|
|
54
51
|
</script>
|
|
55
52
|
|