@puresnake/snake-ui 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/changelog.md +1 -0
- package/components/snake-activity-list/snake-activity-list.vue +365 -0
- package/components/snake-activity-list/types.ts +29 -0
- package/components/snake-auxiliary-segmentation/snake-auxiliary-segmentation.vue +44 -0
- package/components/snake-auxiliary-segmentation/types.ts +5 -0
- package/components/snake-button/snake-button.vue +357 -0
- package/components/snake-button/types.ts +103 -0
- package/components/snake-button-sort/snake-button-sort.vue +72 -0
- package/components/snake-button-sort/types.ts +22 -0
- package/components/snake-calendar/snake-calendar.vue +998 -0
- package/components/snake-calendar/types.ts +189 -0
- package/components/snake-cell-group/snake-cell-group.vue +55 -0
- package/components/snake-cell-group/types.ts +19 -0
- package/components/snake-cell-item/snake-cell-item.vue +159 -0
- package/components/snake-cell-item/types.ts +66 -0
- package/components/snake-checkbox/snake-checkbox.vue +264 -0
- package/components/snake-checkbox/types.ts +70 -0
- package/components/snake-checkbox-group/snake-checkbox-group.vue +154 -0
- package/components/snake-checkbox-group/types.ts +52 -0
- package/components/snake-cms/blocks/v2/cms-v2-carousel.vue +87 -0
- package/components/snake-cms/blocks/v2/cms-v2-coupon.vue +25 -0
- package/components/snake-cms/blocks/v2/cms-v2-custom.vue +12 -0
- package/components/snake-cms/blocks/v2/cms-v2-divider.vue +33 -0
- package/components/snake-cms/blocks/v2/cms-v2-floatbutton.vue +28 -0
- package/components/snake-cms/blocks/v2/cms-v2-goods-list.vue +150 -0
- package/components/snake-cms/blocks/v2/cms-v2-hotzone.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-images.vue +41 -0
- package/components/snake-cms/blocks/v2/cms-v2-magiccube.vue +93 -0
- package/components/snake-cms/blocks/v2/cms-v2-notice.vue +80 -0
- package/components/snake-cms/blocks/v2/cms-v2-popup.vue +46 -0
- package/components/snake-cms/blocks/v2/cms-v2-richtext.vue +18 -0
- package/components/snake-cms/blocks/v2/cms-v2-search.vue +115 -0
- package/components/snake-cms/blocks/v2/cms-v2-video.vue +25 -0
- package/components/snake-cms/blocks/v2/shared.ts +84 -0
- package/components/snake-cms/snake-cms.vue +409 -0
- package/components/snake-cms/types.ts +50 -0
- package/components/snake-commodity-search/snake-commodity-search.vue +234 -0
- package/components/snake-commodity-search/types.ts +11 -0
- package/components/snake-config-provider/snake-config-provider.vue +61 -0
- package/components/snake-config-provider/types.ts +22 -0
- package/components/snake-count-down/snake-count-down.vue +231 -0
- package/components/snake-count-down/types.ts +103 -0
- package/components/snake-coupon/snake-coupon.vue +209 -0
- package/components/snake-coupon/types.ts +21 -0
- package/components/snake-custom-module/snake-custom-module.vue +25 -0
- package/components/snake-custom-module/types.ts +11 -0
- package/components/snake-drop-menu/snake-drop-menu.vue +123 -0
- package/components/snake-drop-menu/types.ts +95 -0
- package/components/snake-drop-menu-item/snake-drop-menu-item.vue +181 -0
- package/components/snake-drop-menu-item/types.ts +48 -0
- package/components/snake-empty/snake-empty.vue +100 -0
- package/components/snake-empty/types.ts +48 -0
- package/components/snake-filter-sorts/filter-page.vue +695 -0
- package/components/snake-filter-sorts/snake-filter-sorts.vue +185 -0
- package/components/snake-filter-sorts/types.ts +57 -0
- package/components/snake-floating-bubble/snake-floating-bubble.vue +157 -0
- package/components/snake-floating-bubble/types.ts +43 -0
- package/components/snake-follow/snake-follow.vue +18 -0
- package/components/snake-follow/types.ts +2 -0
- package/components/snake-form/snake-form.vue +124 -0
- package/components/snake-form/types.ts +96 -0
- package/components/snake-form-item/snake-form-item.vue +331 -0
- package/components/snake-form-item/types.ts +70 -0
- package/components/snake-goods-list/snake-goods-list.vue +792 -0
- package/components/snake-goods-list/types.ts +55 -0
- package/components/snake-graphic-navigation/snake-graphic-navigation.vue +198 -0
- package/components/snake-graphic-navigation/types.ts +43 -0
- package/components/snake-icon/icon-names.ts +222 -0
- package/components/snake-icon/snake-icon.vue +220 -0
- package/components/snake-icon/types.ts +45 -0
- package/components/snake-image/snake-image.vue +230 -0
- package/components/snake-image/types.ts +70 -0
- package/components/snake-images/snake-images.vue +80 -0
- package/components/snake-images/types.ts +5 -0
- package/components/snake-index-anchor/snake-index-anchor.vue +83 -0
- package/components/snake-index-anchor/types.ts +14 -0
- package/components/snake-index-list/anchor-registry.ts +80 -0
- package/components/snake-index-list/snake-index-list.vue +259 -0
- package/components/snake-index-list/types.ts +115 -0
- package/components/snake-index-list-panel/snake-index-list-panel.vue +277 -0
- package/components/snake-index-list-panel/types.ts +10 -0
- package/components/snake-input/snake-input.vue +225 -0
- package/components/snake-input/types.ts +99 -0
- package/components/snake-jump-applet/snake-jump-applet.vue +99 -0
- package/components/snake-jump-applet/types.ts +17 -0
- package/components/snake-line/snake-line.vue +42 -0
- package/components/snake-line/types.ts +30 -0
- package/components/snake-line-progress/snake-line-progress.vue +105 -0
- package/components/snake-line-progress/types.ts +26 -0
- package/components/snake-link/snake-link.vue +74 -0
- package/components/snake-link/types.ts +30 -0
- package/components/snake-list-switching/components/tree-select/index.vue +156 -0
- package/components/snake-list-switching/snake-list-switching.vue +1285 -0
- package/components/snake-list-switching/types.ts +11 -0
- package/components/snake-loading/snake-loading.vue +241 -0
- package/components/snake-loading/types.ts +34 -0
- package/components/snake-loadmore/snake-loadmore.vue +103 -0
- package/components/snake-loadmore/types.ts +56 -0
- package/components/snake-magic-cube/snake-magic-cube.vue +622 -0
- package/components/snake-magic-cube/types.ts +5 -0
- package/components/snake-modal/snake-modal.vue +434 -0
- package/components/snake-modal/types.ts +71 -0
- package/components/snake-navbar/snake-navbar.vue +194 -0
- package/components/snake-navbar/types.ts +54 -0
- package/components/snake-no-network/snake-no-network.vue +125 -0
- package/components/snake-no-network/types.ts +27 -0
- package/components/snake-notice/snake-notice.vue +44 -0
- package/components/snake-notice/types.ts +5 -0
- package/components/snake-notice-bar/snake-notice-bar.vue +336 -0
- package/components/snake-notice-bar/types.ts +82 -0
- package/components/snake-overlay/snake-overlay.vue +73 -0
- package/components/snake-overlay/types.ts +35 -0
- package/components/snake-page-popup/snake-page-popup.vue +146 -0
- package/components/snake-page-popup/types.ts +28 -0
- package/components/snake-parse/audio/audio.vue +286 -0
- package/components/snake-parse/audio/context.js +11 -0
- package/components/snake-parse/audio/index.js +34 -0
- package/components/snake-parse/node/node.vue +830 -0
- package/components/snake-parse/parser.js +1480 -0
- package/components/snake-parse/snake-parse.vue +548 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/handler.js +109 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.js +0 -0
- package/components/snake-parse/static/app-plus/snake-parse/js/uni.webview.min.js +1 -0
- package/components/snake-parse/static/app-plus/snake-parse/local.html +3 -0
- package/components/snake-parse/style/index.js +132 -0
- package/components/snake-parse/style/parser.js +175 -0
- package/components/snake-parse/types.ts +49 -0
- package/components/snake-picture-ads/snake-picture-ads.vue +292 -0
- package/components/snake-picture-ads/types.ts +5 -0
- package/components/snake-popup/snake-popup.vue +348 -0
- package/components/snake-popup/types.ts +88 -0
- package/components/snake-qr-code/qrcode.ts +1214 -0
- package/components/snake-qr-code/snake-qr-code.vue +408 -0
- package/components/snake-qr-code/types.ts +78 -0
- package/components/snake-radio/snake-radio.vue +271 -0
- package/components/snake-radio/types.ts +64 -0
- package/components/snake-radio-group/snake-radio-group.vue +98 -0
- package/components/snake-radio-group/types.ts +48 -0
- package/components/snake-read-more/snake-read-more.vue +140 -0
- package/components/snake-read-more/types.ts +53 -0
- package/components/snake-rich-text/snake-rich-text.vue +24 -0
- package/components/snake-rich-text/types.ts +5 -0
- package/components/snake-root-portal/snake-root-portal.vue +92 -0
- package/components/snake-root-portal/types.ts +9 -0
- package/components/snake-search/snake-search.vue +202 -0
- package/components/snake-search/types.ts +84 -0
- package/components/snake-select/snake-select.vue +371 -0
- package/components/snake-select/types.ts +75 -0
- package/components/snake-skeleton/snake-skeleton.vue +104 -0
- package/components/snake-skeleton/types.ts +32 -0
- package/components/snake-skeleton-item/snake-skeleton-item.vue +90 -0
- package/components/snake-skeleton-item/types.ts +30 -0
- package/components/snake-slider/snake-slider.vue +249 -0
- package/components/snake-slider/types.ts +59 -0
- package/components/snake-sticky/snake-sticky.vue +178 -0
- package/components/snake-sticky/types.ts +48 -0
- package/components/snake-subsection/snake-subsection.vue +188 -0
- package/components/snake-subsection/types.ts +54 -0
- package/components/snake-swiper/snake-swiper.vue +229 -0
- package/components/snake-swiper/types.ts +79 -0
- package/components/snake-switch/snake-switch.vue +100 -0
- package/components/snake-switch/types.ts +41 -0
- package/components/snake-tabbar/snake-tabbar.vue +306 -0
- package/components/snake-tabbar/types.ts +93 -0
- package/components/snake-tabs/snake-tabs.vue +305 -0
- package/components/snake-tabs/types.ts +79 -0
- package/components/snake-text/snake-text.vue +292 -0
- package/components/snake-text/types.ts +100 -0
- package/components/snake-textarea/snake-textarea.vue +171 -0
- package/components/snake-textarea/types.ts +79 -0
- package/components/snake-toast/snake-toast.vue +330 -0
- package/components/snake-toast/types.ts +55 -0
- package/components/snake-tooltip/position.ts +33 -0
- package/components/snake-tooltip/snake-tooltip.vue +339 -0
- package/components/snake-tooltip/types.ts +80 -0
- package/components/snake-transition/snake-transition.vue +315 -0
- package/components/snake-transition/types.ts +65 -0
- package/components/snake-upload/snake-upload.vue +1801 -0
- package/components/snake-upload/types.ts +256 -0
- package/components/snake-videos/snake-videos.vue +122 -0
- package/components/snake-videos/types.ts +7 -0
- package/iconfont.css +881 -0
- package/index.d.ts +7 -0
- package/index.scss +26 -0
- package/index.ts +94 -0
- package/libs/cms/blocks.ts +103 -0
- package/libs/cms/config.ts +25 -0
- package/libs/cms/index.ts +7 -0
- package/libs/cms/normalize.ts +135 -0
- package/libs/cms/resolve.ts +12 -0
- package/libs/cms/types.ts +164 -0
- package/libs/cms/use-commerce.ts +385 -0
- package/libs/cms/v2.ts +193 -0
- package/libs/config/index.ts +4 -0
- package/libs/config/modal.ts +93 -0
- package/libs/config/state.ts +33 -0
- package/libs/config/theme.ts +351 -0
- package/libs/config/toast.ts +71 -0
- package/libs/config/types.ts +135 -0
- package/libs/config/zIndex.ts +44 -0
- package/libs/css/color.scss +105 -0
- package/libs/css/common.scss +171 -0
- package/libs/css/style.h5.scss +7 -0
- package/libs/css/style.mp.scss +7 -0
- package/libs/css/style.theme.scss +70 -0
- package/libs/css/style.vue.scss +140 -0
- package/libs/form/async-validator.min.d.ts +75 -0
- package/libs/form/async-validator.min.js +3 -0
- package/libs/form/index.ts +3 -0
- package/libs/form/path.ts +40 -0
- package/libs/form/types.ts +51 -0
- package/libs/form/validate.ts +149 -0
- package/libs/foundation.ts +96 -0
- package/libs/function/$parent.ts +33 -0
- package/libs/function/clipboard.ts +13 -0
- package/libs/function/color.ts +55 -0
- package/libs/function/debounce.ts +34 -0
- package/libs/function/deepClone.ts +30 -0
- package/libs/function/deepMerge.ts +25 -0
- package/libs/function/emitter.ts +30 -0
- package/libs/function/format.ts +27 -0
- package/libs/function/getParent.ts +53 -0
- package/libs/function/getRect.ts +29 -0
- package/libs/function/guid.ts +11 -0
- package/libs/function/index.ts +31 -0
- package/libs/function/queryParams.ts +73 -0
- package/libs/function/random.ts +6 -0
- package/libs/function/randomArray.ts +14 -0
- package/libs/function/route.ts +155 -0
- package/libs/function/sleep.ts +7 -0
- package/libs/function/style.ts +58 -0
- package/libs/function/styleUtils.ts +83 -0
- package/libs/function/system.ts +14 -0
- package/libs/function/test.ts +202 -0
- package/libs/function/throttle.ts +36 -0
- package/libs/function/timeFormat.ts +27 -0
- package/libs/function/timeFrom.ts +27 -0
- package/libs/function/toast.ts +10 -0
- package/libs/function/trim.ts +11 -0
- package/libs/function/type2icon.ts +11 -0
- package/libs/function/unit.ts +45 -0
- package/libs/hooks/index.ts +11 -0
- package/libs/hooks/useChildren.ts +125 -0
- package/libs/hooks/useColor.ts +5 -0
- package/libs/hooks/useDebounce.ts +5 -0
- package/libs/hooks/useLocale.ts +13 -0
- package/libs/hooks/useModal.ts +131 -0
- package/libs/hooks/useParent.ts +62 -0
- package/libs/hooks/useRect.ts +44 -0
- package/libs/hooks/useRouter.ts +5 -0
- package/libs/hooks/useTheme.ts +31 -0
- package/libs/hooks/useThrottle.ts +5 -0
- package/libs/hooks/useToast.ts +116 -0
- package/libs/index.ts +18 -0
- package/libs/request/auto-http.ts +1 -0
- package/libs/request/index.ts +343 -0
- package/libs/runtime/accessors.ts +55 -0
- package/libs/runtime/context.ts +40 -0
- package/libs/runtime/index.ts +18 -0
- package/libs/runtime/types.ts +49 -0
- package/libs/util/calendar.ts +6 -0
- package/locale/index.ts +130 -0
- package/locale/lang/en-US.ts +67 -0
- package/locale/lang/zh-CN.ts +67 -0
- package/package.json +130 -5
- package/plugins/index.ts +1 -0
- package/plugins/root/README.md +86 -0
- package/plugins/root/index.ts +123 -0
- package/plugins/root/page.ts +77 -0
- package/plugins/root/root.ts +53 -0
- package/plugins/root/utils.ts +137 -0
- package/readme.md +79 -0
- package/theme.scss +118 -0
- package/types/components.d.ts +236 -0
- package/types/global.d.ts +21 -0
- package/types/index.d.ts +6 -0
- package/types/uni-app.d.ts +16 -0
- package/README.md +0 -3
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:style="toStyle(customStyle)"
|
|
4
|
+
class="snake-icon"
|
|
5
|
+
:class="['snake-icon--' + labelPos, customClass]"
|
|
6
|
+
@click="onClick"
|
|
7
|
+
>
|
|
8
|
+
<image v-if="isImg" class="snake-icon__img" :src="props.name" :mode="imgMode" :style="imgStyle" />
|
|
9
|
+
<text
|
|
10
|
+
v-else
|
|
11
|
+
class="snake-icon__icon"
|
|
12
|
+
:class="iconClass"
|
|
13
|
+
:style="toStyle(iconStyle)"
|
|
14
|
+
:hover-class="hoverClass"
|
|
15
|
+
@touchstart="onTouchstart"
|
|
16
|
+
>
|
|
17
|
+
<text
|
|
18
|
+
v-if="showDecimalIcon"
|
|
19
|
+
class="snake-icon__decimal"
|
|
20
|
+
:class="decimalIconClass"
|
|
21
|
+
:style="toStyle(decimalIconStyle)"
|
|
22
|
+
:hover-class="hoverClass"
|
|
23
|
+
/>
|
|
24
|
+
</text>
|
|
25
|
+
<text v-if="label !== ''" class="snake-icon__label" :style="labelStyle">
|
|
26
|
+
{{ label }}
|
|
27
|
+
</text>
|
|
28
|
+
</view>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
export default {
|
|
33
|
+
name: 'snake-icon',
|
|
34
|
+
options: {
|
|
35
|
+
addGlobalClass: true,
|
|
36
|
+
// #ifndef MP-TOUTIAO
|
|
37
|
+
virtualHost: true,
|
|
38
|
+
// #endif
|
|
39
|
+
styleIsolation: 'shared'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
/**
|
|
46
|
+
* @component Icon
|
|
47
|
+
* @description 支持字体图标、图片图标、标签和百分比裁切效果的图标组件。
|
|
48
|
+
* @see /components/icon
|
|
49
|
+
*/
|
|
50
|
+
import { computed } from 'vue';
|
|
51
|
+
import { addUnit } from '../../libs/function/unit';
|
|
52
|
+
import { toStyle } from '../../libs/function/style';
|
|
53
|
+
import { IconProps } from './types';
|
|
54
|
+
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
(event: 'click', index: string | number | unknown): void;
|
|
57
|
+
(event: 'touchstart', index: string | number | unknown): void;
|
|
58
|
+
}>();
|
|
59
|
+
|
|
60
|
+
const props = defineProps(IconProps);
|
|
61
|
+
const themeTypes = ['primary', 'success', 'error', 'warning', 'info'];
|
|
62
|
+
|
|
63
|
+
const iconClass = computed(() => {
|
|
64
|
+
let classes: string[] | string = [];
|
|
65
|
+
classes.push(`${props.customPrefix}-${props.name}`);
|
|
66
|
+
classes.push(props.customPrefix === 'sicon' ? 'snake-iconfont' : props.customPrefix);
|
|
67
|
+
|
|
68
|
+
if (props.showDecimalIcon && props.inactiveColor && themeTypes.includes(props.inactiveColor)) {
|
|
69
|
+
classes.push(`snake-icon__icon--${props.inactiveColor}`);
|
|
70
|
+
} else if (props.color && themeTypes.includes(props.color)) {
|
|
71
|
+
classes.push(`snake-icon__icon--${props.color}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// #ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
|
|
75
|
+
classes = (classes as string[]).join(' ');
|
|
76
|
+
// #endif
|
|
77
|
+
return classes;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const iconStyle = computed(() => {
|
|
81
|
+
const style: Record<string, string> = {
|
|
82
|
+
fontSize: props.size === 'inherit' ? 'inherit' : addUnit(props.size, 'rpx'),
|
|
83
|
+
fontWeight: props.bold ? 'bold' : 'normal',
|
|
84
|
+
top: addUnit(props.top, 'rpx')
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (props.showDecimalIcon && props.inactiveColor && !themeTypes.includes(props.inactiveColor)) {
|
|
88
|
+
style.color = props.inactiveColor;
|
|
89
|
+
} else if (props.color && !themeTypes.includes(props.color)) {
|
|
90
|
+
style.color = props.color;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return style;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const isImg = computed(() => props.name.includes('/'));
|
|
97
|
+
|
|
98
|
+
const imgStyle = computed(() => ({
|
|
99
|
+
width: props.width ? addUnit(props.width, 'rpx') : addUnit(props.size, 'rpx'),
|
|
100
|
+
height: props.height ? addUnit(props.height, 'rpx') : addUnit(props.size, 'rpx')
|
|
101
|
+
}));
|
|
102
|
+
|
|
103
|
+
const decimalIconStyle = computed(() => {
|
|
104
|
+
const style: Record<string, string> = {
|
|
105
|
+
fontSize: props.size === 'inherit' ? 'inherit' : addUnit(props.size, 'rpx'),
|
|
106
|
+
fontWeight: props.bold ? 'bold' : 'normal',
|
|
107
|
+
top: addUnit(props.top, 'rpx'),
|
|
108
|
+
width: `${props.percent}%`
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if (props.color && !themeTypes.includes(props.color)) {
|
|
112
|
+
style.color = props.color;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return style;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const decimalIconClass = computed(() => {
|
|
119
|
+
let classes: string[] | string = [];
|
|
120
|
+
classes.push(`${props.customPrefix}-${props.name}`);
|
|
121
|
+
classes.push(props.customPrefix === 'sicon' ? 'snake-iconfont' : props.customPrefix);
|
|
122
|
+
classes.push(
|
|
123
|
+
props.color && themeTypes.includes(props.color)
|
|
124
|
+
? `snake-icon__icon--${props.color}`
|
|
125
|
+
: 'snake-icon__icon--primary'
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// #ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
|
|
129
|
+
classes = (classes as string[]).join(' ');
|
|
130
|
+
// #endif
|
|
131
|
+
return classes;
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const labelStyle = computed(() => ({
|
|
135
|
+
color: props.labelColor,
|
|
136
|
+
fontSize: addUnit(props.labelSize, 'rpx'),
|
|
137
|
+
marginLeft: props.labelPos === 'right' ? addUnit(props.space || props.marginLeft, 'rpx') : 0,
|
|
138
|
+
marginTop: props.labelPos === 'bottom' ? addUnit(props.space || props.marginTop, 'rpx') : 0,
|
|
139
|
+
marginRight: props.labelPos === 'left' ? addUnit(props.space || props.marginRight, 'rpx') : 0,
|
|
140
|
+
marginBottom: props.labelPos === 'top' ? addUnit(props.space || props.marginBottom, 'rpx') : 0
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
function onClick(event: unknown) {
|
|
144
|
+
emit('click', props.index || event);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function onTouchstart(event: unknown) {
|
|
148
|
+
emit('touchstart', props.index || event);
|
|
149
|
+
}
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<style scoped lang="scss">
|
|
153
|
+
@import '../../iconfont.css';
|
|
154
|
+
|
|
155
|
+
.snake-icon {
|
|
156
|
+
display: inline-flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
|
|
159
|
+
&--left {
|
|
160
|
+
flex-direction: row-reverse;
|
|
161
|
+
align-items: center;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
&--right {
|
|
165
|
+
flex-direction: row;
|
|
166
|
+
align-items: center;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&--top {
|
|
170
|
+
flex-direction: column-reverse;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&--bottom {
|
|
175
|
+
flex-direction: column;
|
|
176
|
+
justify-content: center;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&__icon {
|
|
180
|
+
position: relative;
|
|
181
|
+
|
|
182
|
+
&--primary {
|
|
183
|
+
color: var(--snake-color-primary, #06d290);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&--success {
|
|
187
|
+
color: var(--snake-color-success, #19be6b);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&--error {
|
|
191
|
+
color: var(--snake-color-error, #fa3534);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&--warning {
|
|
195
|
+
color: var(--snake-color-warning, #ff9900);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&--info {
|
|
199
|
+
color: var(--snake-color-info, #909399);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
&__decimal {
|
|
204
|
+
position: absolute;
|
|
205
|
+
top: 0;
|
|
206
|
+
left: 0;
|
|
207
|
+
display: inline-block;
|
|
208
|
+
overflow: hidden;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&__img {
|
|
212
|
+
height: auto;
|
|
213
|
+
will-change: transform;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&__label {
|
|
217
|
+
line-height: 1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { ImageMode, StyleValue } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/** 标签相对图标的显示方向。 */
|
|
5
|
+
export type IconLabelPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
6
|
+
|
|
7
|
+
/** Icon 运行时属性。 */
|
|
8
|
+
export const IconProps = {
|
|
9
|
+
customStyle: { type: [String, Object, Array] as PropType<StyleValue>, default: () => ({}) },
|
|
10
|
+
customClass: { type: String, default: '' },
|
|
11
|
+
name: { type: String, default: '' },
|
|
12
|
+
color: { type: String, default: '' },
|
|
13
|
+
size: { type: [Number, String] as PropType<string | number>, default: 'inherit' },
|
|
14
|
+
bold: { type: Boolean, default: false },
|
|
15
|
+
index: { type: [Number, String] as PropType<string | number>, default: '' },
|
|
16
|
+
hoverClass: { type: String, default: '' },
|
|
17
|
+
customPrefix: { type: String, default: 'sicon' },
|
|
18
|
+
label: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
19
|
+
labelPos: { type: String as PropType<IconLabelPosition>, default: 'right' },
|
|
20
|
+
labelSize: { type: [String, Number] as PropType<string | number>, default: '28' },
|
|
21
|
+
labelColor: { type: String, default: 'var(--snake-color-text-secondary, #606266)' },
|
|
22
|
+
marginLeft: { type: [String, Number] as PropType<string | number>, default: '6' },
|
|
23
|
+
marginTop: { type: [String, Number] as PropType<string | number>, default: '6' },
|
|
24
|
+
marginRight: { type: [String, Number] as PropType<string | number>, default: '6' },
|
|
25
|
+
marginBottom: { type: [String, Number] as PropType<string | number>, default: '6' },
|
|
26
|
+
space: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
27
|
+
imgMode: { type: String as PropType<ImageMode>, default: 'widthFix' },
|
|
28
|
+
width: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
29
|
+
height: { type: [String, Number] as PropType<string | number>, default: '' },
|
|
30
|
+
top: { type: [String, Number] as PropType<string | number>, default: 0 },
|
|
31
|
+
showDecimalIcon: { type: Boolean, default: false },
|
|
32
|
+
inactiveColor: { type: String, default: 'var(--snake-color-divider, #e4e7ed)' },
|
|
33
|
+
percent: { type: [Number, String] as PropType<string | number>, default: '50' }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Icon 组件的公开属性类型。 */
|
|
37
|
+
export type IconProps = ExtractPropTypes<typeof IconProps>;
|
|
38
|
+
|
|
39
|
+
/** Icon 组件的公开事件。 */
|
|
40
|
+
export type IconEmits = {
|
|
41
|
+
/** 点击图标时返回 index,未设置时返回原始事件。 */
|
|
42
|
+
(event: 'click', index: string | number | unknown): void;
|
|
43
|
+
/** 触摸图标时返回 index,未设置时返回原始事件。 */
|
|
44
|
+
(event: 'touchstart', index: string | number | unknown): void;
|
|
45
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="snake-image" :class="customClass" :style="rootStyle" :aria-label="alt || undefined" @click="click">
|
|
3
|
+
<image
|
|
4
|
+
v-if="displaySrc"
|
|
5
|
+
:key="imageKey"
|
|
6
|
+
class="snake-image__image"
|
|
7
|
+
:src="displaySrc"
|
|
8
|
+
:alt="alt"
|
|
9
|
+
:mode="mode"
|
|
10
|
+
:show-menu-by-longpress="showMenuByLongpress"
|
|
11
|
+
:webp="webp"
|
|
12
|
+
:style="imageStyle"
|
|
13
|
+
@load="onLoad"
|
|
14
|
+
@error="onError"
|
|
15
|
+
/>
|
|
16
|
+
<view v-if="isLoading && showLoading" class="snake-image__status" :style="statusStyle">
|
|
17
|
+
<slot name="loading">
|
|
18
|
+
<image v-if="loadingImg" class="snake-image__status-image" :src="loadingImg" mode="aspectFit" />
|
|
19
|
+
<snake-icon v-else-if="loadingIcon" :name="loadingIcon" />
|
|
20
|
+
<snake-loading v-else size="20" />
|
|
21
|
+
</slot>
|
|
22
|
+
</view>
|
|
23
|
+
<view
|
|
24
|
+
v-else-if="status === 'error' && showError"
|
|
25
|
+
class="snake-image__status snake-image__status--error"
|
|
26
|
+
:style="statusStyle"
|
|
27
|
+
>
|
|
28
|
+
<slot name="error">
|
|
29
|
+
<image v-if="errorImg" class="snake-image__status-image" :src="errorImg" mode="aspectFit" />
|
|
30
|
+
<template v-else>
|
|
31
|
+
<snake-icon :name="errorIcon" size="22" />
|
|
32
|
+
<text class="snake-image__error-text">{{ errorText }}</text>
|
|
33
|
+
</template>
|
|
34
|
+
</slot>
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
/**
|
|
41
|
+
* @component Image
|
|
42
|
+
* @description 封装 uni-app `image`,提供加载、失败、淡入、圆角、圆形、WebP、长按菜单和图片预览能力。`src` 变化时会自动重置状态。
|
|
43
|
+
* @see /components/image
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
import { computed, getCurrentInstance, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
47
|
+
import { addUnit } from '../../libs/function/unit';
|
|
48
|
+
import { translate } from '../../locale';
|
|
49
|
+
import type { ImageEmits, ImageExpose, ImageProps } from './types';
|
|
50
|
+
|
|
51
|
+
defineOptions({ name: 'SnakeImage', options: { virtualHost: true, styleIsolation: 'shared' } });
|
|
52
|
+
|
|
53
|
+
const props = withDefaults(defineProps<ImageProps>(), {
|
|
54
|
+
src: '',
|
|
55
|
+
alt: '',
|
|
56
|
+
mode: 'scaleToFill',
|
|
57
|
+
width: '100%',
|
|
58
|
+
height: 'auto',
|
|
59
|
+
shape: 'square',
|
|
60
|
+
radius: 0,
|
|
61
|
+
lazyLoad: false,
|
|
62
|
+
lazyThreshold: 100,
|
|
63
|
+
showMenuByLongpress: false,
|
|
64
|
+
webp: false,
|
|
65
|
+
fade: true,
|
|
66
|
+
duration: 300,
|
|
67
|
+
showLoading: true,
|
|
68
|
+
loadingIcon: '',
|
|
69
|
+
loadingImg: '',
|
|
70
|
+
showError: true,
|
|
71
|
+
errorIcon: 'image',
|
|
72
|
+
errorImg: '',
|
|
73
|
+
preview: false,
|
|
74
|
+
customClass: '',
|
|
75
|
+
customStyle: ''
|
|
76
|
+
});
|
|
77
|
+
const emit = defineEmits<ImageEmits>();
|
|
78
|
+
type ImageStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
79
|
+
|
|
80
|
+
const status = ref<ImageStatus>(props.src ? (props.lazyLoad ? 'idle' : 'loading') : 'error');
|
|
81
|
+
const shouldLoad = ref(!props.lazyLoad && Boolean(props.src));
|
|
82
|
+
const imageKey = ref(0);
|
|
83
|
+
const instance = getCurrentInstance();
|
|
84
|
+
let observer: ReturnType<typeof uni.createIntersectionObserver> | undefined;
|
|
85
|
+
let mounted = false;
|
|
86
|
+
|
|
87
|
+
const isLoading = computed(() => status.value === 'idle' || status.value === 'loading');
|
|
88
|
+
const displaySrc = computed(() => (shouldLoad.value ? props.src : ''));
|
|
89
|
+
const previewUrls = computed(() => (props.previewUrls?.length ? props.previewUrls : [props.src]));
|
|
90
|
+
const autoHeight = computed(() => props.height === 'auto' || props.height == null);
|
|
91
|
+
const errorText = computed(() => translate('image.error'));
|
|
92
|
+
const rootStyle = computed(() => [
|
|
93
|
+
{
|
|
94
|
+
width: addUnit(props.width),
|
|
95
|
+
height: autoHeight.value ? 'auto' : addUnit(props.height),
|
|
96
|
+
borderRadius: props.shape === 'circle' ? '50%' : addUnit(props.radius),
|
|
97
|
+
backgroundColor: props.bgColor
|
|
98
|
+
},
|
|
99
|
+
props.customStyle
|
|
100
|
+
]);
|
|
101
|
+
const imageStyle = computed(() => ({
|
|
102
|
+
height: autoHeight.value ? 'auto' : '100%',
|
|
103
|
+
opacity: status.value === 'success' ? 1 : 0,
|
|
104
|
+
transitionDuration: props.fade ? `${props.duration}ms` : '0ms'
|
|
105
|
+
}));
|
|
106
|
+
const statusStyle = computed(() => (autoHeight.value ? undefined : { minHeight: '0' }));
|
|
107
|
+
|
|
108
|
+
function disconnectObserver() {
|
|
109
|
+
observer?.disconnect();
|
|
110
|
+
observer = undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function startLoading() {
|
|
114
|
+
if (!props.src) {
|
|
115
|
+
status.value = 'error';
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
shouldLoad.value = true;
|
|
119
|
+
status.value = 'loading';
|
|
120
|
+
disconnectObserver();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function observeViewport() {
|
|
124
|
+
if (!props.lazyLoad || !props.src || !mounted || typeof uni === 'undefined' || !uni.createIntersectionObserver) {
|
|
125
|
+
startLoading();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
observer = uni.createIntersectionObserver(instance?.proxy as any, { thresholds: [0, 0.01] });
|
|
130
|
+
observer
|
|
131
|
+
.relativeToViewport({ top: props.lazyThreshold, bottom: props.lazyThreshold })
|
|
132
|
+
.observe('.snake-image', result => {
|
|
133
|
+
if (result?.intersectionRatio > 0) startLoading();
|
|
134
|
+
});
|
|
135
|
+
} catch {
|
|
136
|
+
startLoading();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function resetLoadState() {
|
|
141
|
+
disconnectObserver();
|
|
142
|
+
imageKey.value += 1;
|
|
143
|
+
if (!props.src) {
|
|
144
|
+
shouldLoad.value = false;
|
|
145
|
+
status.value = 'error';
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!props.lazyLoad) {
|
|
149
|
+
startLoading();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
shouldLoad.value = false;
|
|
153
|
+
status.value = 'idle';
|
|
154
|
+
observeViewport();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function onLoad(event: unknown) {
|
|
158
|
+
status.value = 'success';
|
|
159
|
+
emit('load', event);
|
|
160
|
+
}
|
|
161
|
+
function onError(event: unknown) {
|
|
162
|
+
status.value = 'error';
|
|
163
|
+
emit('error', event);
|
|
164
|
+
}
|
|
165
|
+
/** 供业务在失败重试或鉴权地址刷新后重新发起当前资源请求。 */
|
|
166
|
+
function reload() {
|
|
167
|
+
resetLoadState();
|
|
168
|
+
}
|
|
169
|
+
function click(event: unknown) {
|
|
170
|
+
emit('click', event);
|
|
171
|
+
if (
|
|
172
|
+
props.preview &&
|
|
173
|
+
status.value === 'success' &&
|
|
174
|
+
props.src &&
|
|
175
|
+
typeof uni !== 'undefined' &&
|
|
176
|
+
typeof uni.previewImage === 'function'
|
|
177
|
+
) {
|
|
178
|
+
const urls = previewUrls.value;
|
|
179
|
+
uni.previewImage({ current: urls.includes(props.src) ? props.src : urls[0], urls });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
watch([() => props.src, () => props.lazyLoad, () => props.lazyThreshold], resetLoadState);
|
|
184
|
+
onMounted(() => {
|
|
185
|
+
mounted = true;
|
|
186
|
+
resetLoadState();
|
|
187
|
+
});
|
|
188
|
+
onBeforeUnmount(disconnectObserver);
|
|
189
|
+
|
|
190
|
+
defineExpose<ImageExpose>({ reload });
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<style lang="scss" scoped>
|
|
194
|
+
.snake-image {
|
|
195
|
+
position: relative;
|
|
196
|
+
display: block;
|
|
197
|
+
box-sizing: border-box;
|
|
198
|
+
overflow: hidden;
|
|
199
|
+
}
|
|
200
|
+
.snake-image__image {
|
|
201
|
+
display: block;
|
|
202
|
+
width: 100%;
|
|
203
|
+
transition-property: opacity;
|
|
204
|
+
}
|
|
205
|
+
.snake-image__status {
|
|
206
|
+
position: absolute;
|
|
207
|
+
top: 0;
|
|
208
|
+
right: 0;
|
|
209
|
+
bottom: 0;
|
|
210
|
+
left: 0;
|
|
211
|
+
display: flex;
|
|
212
|
+
align-items: center;
|
|
213
|
+
justify-content: center;
|
|
214
|
+
min-height: 120rpx;
|
|
215
|
+
color: var(--snake-image-status-color, var(--snake-color-text-muted, #909399));
|
|
216
|
+
background-color: var(--snake-image-status-bg, transparent);
|
|
217
|
+
}
|
|
218
|
+
.snake-image__status--error {
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
font-size: 24rpx;
|
|
221
|
+
color: var(--snake-image-error-color, var(--snake-color-text-muted, #909399));
|
|
222
|
+
}
|
|
223
|
+
.snake-image__status-image {
|
|
224
|
+
width: 100%;
|
|
225
|
+
height: 100%;
|
|
226
|
+
}
|
|
227
|
+
.snake-image__error-text {
|
|
228
|
+
margin-top: 10rpx;
|
|
229
|
+
}
|
|
230
|
+
</style>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { UnitValue } from '../../libs/function/unit';
|
|
2
|
+
import type { ImageMode, StyleValue } from '../../types/global';
|
|
3
|
+
|
|
4
|
+
/** Image 组件的公开属性。 */
|
|
5
|
+
export interface ImageProps {
|
|
6
|
+
/** 资源地址。 */
|
|
7
|
+
src?: string;
|
|
8
|
+
/** 图片替代文本。 */
|
|
9
|
+
alt?: string;
|
|
10
|
+
/** 组件展示模式。 */
|
|
11
|
+
mode?: ImageMode;
|
|
12
|
+
/** 组件宽度。 */
|
|
13
|
+
width?: UnitValue;
|
|
14
|
+
/** 组件高度。 */
|
|
15
|
+
height?: UnitValue | 'auto';
|
|
16
|
+
/** 组件形状。 */
|
|
17
|
+
shape?: 'square' | 'circle';
|
|
18
|
+
/** 圆角尺寸。 */
|
|
19
|
+
radius?: UnitValue;
|
|
20
|
+
/** 是否开启视口懒加载;进入预加载范围后才设置真实图片地址。 */
|
|
21
|
+
lazyLoad?: boolean;
|
|
22
|
+
/** 视口懒加载的预加载距离。 */
|
|
23
|
+
lazyThreshold?: number;
|
|
24
|
+
/** show menu by longpress 配置。 */
|
|
25
|
+
showMenuByLongpress?: boolean;
|
|
26
|
+
/** webp 配置。 */
|
|
27
|
+
webp?: boolean;
|
|
28
|
+
/** fade 配置。 */
|
|
29
|
+
fade?: boolean;
|
|
30
|
+
/** 动画持续时间。 */
|
|
31
|
+
duration?: number;
|
|
32
|
+
/** 背景颜色。 */
|
|
33
|
+
bgColor?: string;
|
|
34
|
+
/** show loading 配置。 */
|
|
35
|
+
showLoading?: boolean;
|
|
36
|
+
/** loading icon 配置。 */
|
|
37
|
+
loadingIcon?: string;
|
|
38
|
+
/** 加载中显示的图片地址。 */
|
|
39
|
+
loadingImg?: string;
|
|
40
|
+
/** show error 配置。 */
|
|
41
|
+
showError?: boolean;
|
|
42
|
+
/** error icon 配置。 */
|
|
43
|
+
errorIcon?: string;
|
|
44
|
+
/** 加载失败显示的图片地址。 */
|
|
45
|
+
errorImg?: string;
|
|
46
|
+
/** preview 配置。 */
|
|
47
|
+
preview?: boolean;
|
|
48
|
+
/** preview urls 配置。 */
|
|
49
|
+
previewUrls?: string[];
|
|
50
|
+
/** 根节点自定义类名。 */
|
|
51
|
+
customClass?: string;
|
|
52
|
+
/** 根节点自定义样式。 */
|
|
53
|
+
customStyle?: StyleValue;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Image 组件的事件契约。 */
|
|
57
|
+
export type ImageEmits = {
|
|
58
|
+
/** load 事件携带的参数。 */
|
|
59
|
+
load: [event: unknown];
|
|
60
|
+
/** error 事件携带的参数。 */
|
|
61
|
+
error: [event: unknown];
|
|
62
|
+
/** click 事件携带的参数。 */
|
|
63
|
+
click: [event: unknown];
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/** Image 组件通过模板 ref 暴露的实例方法。 */
|
|
67
|
+
export interface ImageExpose {
|
|
68
|
+
/** 按当前资源和懒加载策略重新请求图片。 */
|
|
69
|
+
reload: () => void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="images">
|
|
3
|
+
<view
|
|
4
|
+
class="images-wrap"
|
|
5
|
+
:style="{
|
|
6
|
+
padding: addUnit(imgsData.paddingLR, 'rpx')
|
|
7
|
+
}"
|
|
8
|
+
:role="imgsData.url ? 'link' : 'img'"
|
|
9
|
+
:tabindex="imgsData.url ? 0 : -1"
|
|
10
|
+
:aria-label="imgsData.alt || '查看图片链接'"
|
|
11
|
+
@click="open"
|
|
12
|
+
@keydown.enter.prevent="open"
|
|
13
|
+
>
|
|
14
|
+
<image
|
|
15
|
+
class="image"
|
|
16
|
+
:src="imgsData.src"
|
|
17
|
+
:style="{ height: !imgsData.height ? '100%' : addUnit(imgsData.height, 'rpx') }"
|
|
18
|
+
:aria-label="imgsData.alt || undefined"
|
|
19
|
+
:mode="imgMode"
|
|
20
|
+
></image>
|
|
21
|
+
</view>
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
/**
|
|
27
|
+
* @component Images
|
|
28
|
+
* @description 根据当前运行平台选择图片配置,并支持点击跳转。
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { computed } from 'vue';
|
|
32
|
+
import { addUnit } from '../../libs/function/unit';
|
|
33
|
+
import { navTo } from '../../libs/function/route';
|
|
34
|
+
import type { ImagesProps } from './types';
|
|
35
|
+
|
|
36
|
+
defineOptions({ name: 'Images', options: { virtualHost: true, styleIsolation: 'shared' } });
|
|
37
|
+
const props = withDefaults(defineProps<ImagesProps>(), { datas: () => ({}) });
|
|
38
|
+
const platform = computed(() => {
|
|
39
|
+
let value = 'h5';
|
|
40
|
+
// #ifdef APP-PLUS
|
|
41
|
+
value = 'app';
|
|
42
|
+
// #endif
|
|
43
|
+
|
|
44
|
+
// #ifdef MP-WEIXIN
|
|
45
|
+
value = 'wxma';
|
|
46
|
+
// #endif
|
|
47
|
+
|
|
48
|
+
// #ifdef MP-ALIPAY
|
|
49
|
+
value = 'alima';
|
|
50
|
+
// #endif
|
|
51
|
+
|
|
52
|
+
return value;
|
|
53
|
+
});
|
|
54
|
+
const imgsData = computed(() => {
|
|
55
|
+
const options = Array.isArray(props.datas.platformOptions) ? props.datas.platformOptions : [];
|
|
56
|
+
const selected = options.find(item => item.value === platform.value)?.imgs;
|
|
57
|
+
return (selected?.src ? selected : options[0]?.imgs) || {};
|
|
58
|
+
});
|
|
59
|
+
const imgMode = computed(() => (!imgsData.value.height ? 'widthFix' : 'scaleToFill'));
|
|
60
|
+
function open() {
|
|
61
|
+
if (imgsData.value.url) navTo(imgsData.value.url);
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss" scoped>
|
|
66
|
+
.images {
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
}
|
|
70
|
+
.images-warp {
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
width: 100vw;
|
|
73
|
+
height: auto;
|
|
74
|
+
}
|
|
75
|
+
.image {
|
|
76
|
+
display: flex;
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
}
|
|
80
|
+
</style>
|