@gmcb/uv-ui 0.2.26
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/CHANGELOG.md +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否展示骨架组件
|
|
4
|
+
loading: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: true
|
|
7
|
+
},
|
|
8
|
+
// 是否开启动画效果
|
|
9
|
+
animate: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: true
|
|
12
|
+
},
|
|
13
|
+
// 段落占位图行数
|
|
14
|
+
rows: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: 0
|
|
17
|
+
},
|
|
18
|
+
// 段落占位图的宽度
|
|
19
|
+
rowsWidth: {
|
|
20
|
+
type: [String, Number, Array],
|
|
21
|
+
default: '100%'
|
|
22
|
+
},
|
|
23
|
+
// 段落占位图的高度
|
|
24
|
+
rowsHeight: {
|
|
25
|
+
type: [String, Number, Array],
|
|
26
|
+
default: 18
|
|
27
|
+
},
|
|
28
|
+
// 段落占位图的左边距
|
|
29
|
+
rowsLeft: {
|
|
30
|
+
type: [String, Number, Array],
|
|
31
|
+
default: 0
|
|
32
|
+
},
|
|
33
|
+
// 是否展示标题占位图
|
|
34
|
+
title: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true
|
|
37
|
+
},
|
|
38
|
+
// 段落标题的宽度
|
|
39
|
+
titleWidth: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: '50%'
|
|
42
|
+
},
|
|
43
|
+
// 段落标题的高度
|
|
44
|
+
titleHeight: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
default: 18
|
|
47
|
+
},
|
|
48
|
+
// 是否展示头像占位图
|
|
49
|
+
avatar: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
52
|
+
},
|
|
53
|
+
// 头像占位图大小
|
|
54
|
+
avatarSize: {
|
|
55
|
+
type: [String, Number],
|
|
56
|
+
default: 32
|
|
57
|
+
},
|
|
58
|
+
// 头像占位图的形状,circle-圆形,square-方形
|
|
59
|
+
avatarShape: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: 'circle'
|
|
62
|
+
},
|
|
63
|
+
...uni.$uv?.props?.skeleton
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-skeleton">
|
|
3
|
+
<view
|
|
4
|
+
class="uv-skeleton__wrapper"
|
|
5
|
+
ref="uv-skeleton__wrapper"
|
|
6
|
+
v-if="loading"
|
|
7
|
+
style="display: flex; flex-direction: row;"
|
|
8
|
+
>
|
|
9
|
+
<view
|
|
10
|
+
class="uv-skeleton__wrapper__avatar"
|
|
11
|
+
v-if="avatar"
|
|
12
|
+
:class="[`uv-skeleton__wrapper__avatar--${avatarShape}`, animate && 'animate']"
|
|
13
|
+
:style="{
|
|
14
|
+
height: $uv.addUnit(avatarSize),
|
|
15
|
+
width: $uv.addUnit(avatarSize)
|
|
16
|
+
}"
|
|
17
|
+
></view>
|
|
18
|
+
<view
|
|
19
|
+
class="uv-skeleton__wrapper__content"
|
|
20
|
+
ref="uv-skeleton__wrapper__content"
|
|
21
|
+
style="flex: 1;"
|
|
22
|
+
>
|
|
23
|
+
<view
|
|
24
|
+
class="uv-skeleton__wrapper__content__title"
|
|
25
|
+
v-if="title"
|
|
26
|
+
:style="{
|
|
27
|
+
width: uTitleWidth,
|
|
28
|
+
height: $uv.addUnit(titleHeight),
|
|
29
|
+
}"
|
|
30
|
+
:class="[animate && 'animate']"
|
|
31
|
+
></view>
|
|
32
|
+
<view
|
|
33
|
+
class="uv-skeleton__wrapper__content__rows"
|
|
34
|
+
:class="[animate && 'animate']"
|
|
35
|
+
v-for="(item, index) in rowsArray"
|
|
36
|
+
:key="index"
|
|
37
|
+
:style="{
|
|
38
|
+
width: item.width,
|
|
39
|
+
height: item.height,
|
|
40
|
+
marginTop: item.marginTop,
|
|
41
|
+
marginLeft: item.marginLeft
|
|
42
|
+
}"
|
|
43
|
+
>
|
|
44
|
+
|
|
45
|
+
</view>
|
|
46
|
+
</view>
|
|
47
|
+
</view>
|
|
48
|
+
<slot v-else />
|
|
49
|
+
</view>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
54
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
55
|
+
import props from './props.js';
|
|
56
|
+
// #ifdef APP-NVUE
|
|
57
|
+
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度
|
|
58
|
+
const dom = uni.requireNativePlugin('dom')
|
|
59
|
+
const animation = uni.requireNativePlugin('animation')
|
|
60
|
+
// #endif
|
|
61
|
+
/**
|
|
62
|
+
* Skeleton 骨架屏
|
|
63
|
+
* @description 骨架屏一般用于页面在请求远程数据尚未完成时,页面用灰色块预显示本来的页面结构,给用户更好的体验。
|
|
64
|
+
* @tutorial https://www.uvui.cn/components/skeleton.html
|
|
65
|
+
* @property {Boolean} loading 是否显示骨架占位图,设置为false将会展示子组件内容 (默认 true )
|
|
66
|
+
* @property {Boolean} animate 是否开启动画效果 (默认 true )
|
|
67
|
+
* @property {String | Number} rows 段落占位图行数 (默认 0 )
|
|
68
|
+
* @property {String | Number | Array} rowsWidth 段落占位图的宽度,可以为百分比,数值,带单位字符串等,可通过数组传入指定每个段落行的宽度 (默认 '100%' )
|
|
69
|
+
* @property {String | Number | Array} rowsHeight 段落的高度 (默认 18 )
|
|
70
|
+
* @property {String | Number | Array} rowsLeft 段落的左边距 (默认 0 )
|
|
71
|
+
* @property {Boolean} title 是否展示标题占位图 (默认 true )
|
|
72
|
+
* @property {String | Number} titleWidth 标题的宽度 (默认 '50%' )
|
|
73
|
+
* @property {String | Number} titleHeight 标题的高度 (默认 18 )
|
|
74
|
+
* @property {Boolean} avatar 是否展示头像占位图 (默认 false )
|
|
75
|
+
* @property {String | Number} avatarSize 头像占位图大小 (默认 32 )
|
|
76
|
+
* @property {String} avatarShape 头像占位图的形状,circle-圆形,square-方形 (默认 'circle' )
|
|
77
|
+
* @example <uv-skeleton :loading="true" :animate="true"></uv-skeleton>
|
|
78
|
+
*/
|
|
79
|
+
export default {
|
|
80
|
+
name: 'uv-skeleton',
|
|
81
|
+
mixins: [mpMixin, mixin, props],
|
|
82
|
+
data() {
|
|
83
|
+
return {
|
|
84
|
+
width: 0,
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
watch: {
|
|
88
|
+
loading() {
|
|
89
|
+
this.getComponentWidth()
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
computed: {
|
|
93
|
+
rowsArray() {
|
|
94
|
+
if (/%$/.test(this.rowsHeight)) {
|
|
95
|
+
this.$uv.error('rowsHeight参数不支持百分比单位')
|
|
96
|
+
}
|
|
97
|
+
const rows = []
|
|
98
|
+
for (let i = 0; i < this.rows; i++) {
|
|
99
|
+
let item = {},
|
|
100
|
+
// 需要预防超出数组边界的情况
|
|
101
|
+
rowWidth = this.$uv.test.array(this.rowsWidth) ? (this.rowsWidth[i] || (i === this.row - 1 ? '70%' : '100%')) : i ===
|
|
102
|
+
this.rows - 1 ? '70%' : this.rowsWidth,
|
|
103
|
+
rowHeight = this.$uv.test.array(this.rowsHeight) ? (this.rowsHeight[i] || '18px') : this.rowsHeight,
|
|
104
|
+
rowLeft = this.$uv.test.array(this.rowsLeft) ? (this.rowsLeft[i] || 0) : this.rowsLeft;
|
|
105
|
+
// 如果有title占位图,第一个段落占位图的外边距需要大一些,如果没有title占位图,第一个段落占位图则无需外边距
|
|
106
|
+
// 之所以需要这么做,是因为weex的无能,以提升性能为借口不支持css的一些伪类
|
|
107
|
+
item.marginTop = !this.title && i === 0 ? 0 : this.title && i === 0 ? '20px' : '12px'
|
|
108
|
+
// 如果设置的为百分比的宽度,转换为px值,因为nvue不支持百分比单位
|
|
109
|
+
if (/%$/.test(rowWidth)) {
|
|
110
|
+
// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
|
|
111
|
+
item.width = this.$uv.addUnit(this.width * parseInt(rowWidth) / 100)
|
|
112
|
+
} else {
|
|
113
|
+
item.width = this.$uv.addUnit(rowWidth)
|
|
114
|
+
}
|
|
115
|
+
item.height = this.$uv.addUnit(rowHeight)
|
|
116
|
+
item.marginLeft = this.$uv.addUnit(rowLeft)
|
|
117
|
+
rows.push(item)
|
|
118
|
+
}
|
|
119
|
+
// console.log(rows);
|
|
120
|
+
return rows
|
|
121
|
+
},
|
|
122
|
+
uTitleWidth() {
|
|
123
|
+
let tWidth = 0
|
|
124
|
+
if (/%$/.test(this.titleWidth)) {
|
|
125
|
+
// 通过parseInt提取出百分比单位中的数值部分,除以100得到百分比的小数值
|
|
126
|
+
tWidth = this.$uv.addUnit(this.width * parseInt(this.titleWidth) / 100)
|
|
127
|
+
} else {
|
|
128
|
+
tWidth = this.$uv.addUnit(this.titleWidth)
|
|
129
|
+
}
|
|
130
|
+
return this.$uv.addUnit(tWidth)
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
},
|
|
134
|
+
mounted() {
|
|
135
|
+
this.init()
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
init() {
|
|
139
|
+
this.getComponentWidth()
|
|
140
|
+
// #ifdef APP-NVUE
|
|
141
|
+
this.loading && this.animate && this.setNvueAnimation()
|
|
142
|
+
// #endif
|
|
143
|
+
},
|
|
144
|
+
async setNvueAnimation() {
|
|
145
|
+
// #ifdef APP-NVUE
|
|
146
|
+
// 为了让opacity:1的状态保持一定时间,这里做一个延时
|
|
147
|
+
await this.$uv.sleep(500)
|
|
148
|
+
const skeleton = this.$refs['uv-skeleton__wrapper'];
|
|
149
|
+
skeleton && this.loading && this.animate && animation.transition(skeleton, {
|
|
150
|
+
styles: {
|
|
151
|
+
opacity: 0.5
|
|
152
|
+
},
|
|
153
|
+
duration: 600,
|
|
154
|
+
}, () => {
|
|
155
|
+
// 这里无需判断是否loading和开启动画状态,因为最终的状态必须达到opacity: 1,否则可能
|
|
156
|
+
// 会停留在opacity: 0.5的状态中
|
|
157
|
+
animation.transition(skeleton, {
|
|
158
|
+
styles: {
|
|
159
|
+
opacity: 1
|
|
160
|
+
},
|
|
161
|
+
duration: 600,
|
|
162
|
+
}, () => {
|
|
163
|
+
// 只有在loading中时,才执行动画
|
|
164
|
+
this.loading && this.animate && this.setNvueAnimation()
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
// #endif
|
|
168
|
+
},
|
|
169
|
+
// 获取组件的宽度
|
|
170
|
+
async getComponentWidth() {
|
|
171
|
+
// 延时一定时间,以获取dom尺寸
|
|
172
|
+
await this.$uv.sleep(20)
|
|
173
|
+
// #ifndef APP-NVUE
|
|
174
|
+
this.$uvGetRect('.uv-skeleton__wrapper__content').then(size => {
|
|
175
|
+
this.width = size.width
|
|
176
|
+
})
|
|
177
|
+
// #endif
|
|
178
|
+
|
|
179
|
+
// #ifdef APP-NVUE
|
|
180
|
+
const ref = this.$refs['uv-skeleton__wrapper__content']
|
|
181
|
+
ref && dom.getComponentRect(ref, (res) => {
|
|
182
|
+
this.width = res.size.width
|
|
183
|
+
})
|
|
184
|
+
// #endif
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
</script>
|
|
189
|
+
|
|
190
|
+
<style lang="scss" scoped>
|
|
191
|
+
@import '../../libs/css/components.scss';
|
|
192
|
+
|
|
193
|
+
@mixin background {
|
|
194
|
+
/* #ifdef APP-NVUE */
|
|
195
|
+
background-color: #F1F2F4;
|
|
196
|
+
/* #endif */
|
|
197
|
+
/* #ifndef APP-NVUE */
|
|
198
|
+
background: linear-gradient(90deg, #F1F2F4 25%, #e6e6e6 37%, #F1F2F4 50%);
|
|
199
|
+
background-size: 400% 100%;
|
|
200
|
+
/* #endif */
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.uv-skeleton {
|
|
204
|
+
flex: 1;
|
|
205
|
+
|
|
206
|
+
&__wrapper {
|
|
207
|
+
@include flex(row);
|
|
208
|
+
|
|
209
|
+
&__avatar {
|
|
210
|
+
@include background;
|
|
211
|
+
margin-right: 15px;
|
|
212
|
+
|
|
213
|
+
&--circle {
|
|
214
|
+
border-radius: 100px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
&--square {
|
|
218
|
+
border-radius: 4px;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
&__content {
|
|
223
|
+
flex: 1;
|
|
224
|
+
|
|
225
|
+
&__rows,
|
|
226
|
+
&__title {
|
|
227
|
+
@include background;
|
|
228
|
+
border-radius: 3px;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* #ifndef APP-NVUE */
|
|
235
|
+
.animate {
|
|
236
|
+
animation: skeleton 1.8s ease infinite
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@keyframes skeleton {
|
|
240
|
+
0% {
|
|
241
|
+
background-position: 100% 50%
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
100% {
|
|
245
|
+
background-position: 0 50%
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* #endif */
|
|
250
|
+
</style>
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="uv-skeleton">
|
|
3
|
+
<view v-if="loading">
|
|
4
|
+
<view v-for="(item, index) in elements" :key="index">
|
|
5
|
+
<!-- 横向并列布局 -->
|
|
6
|
+
<view class="uv-skeleton__group" :style="[style(item)]" v-if="item.type=='flex'">
|
|
7
|
+
<view v-for="(item2,index2) in item.children" :class="[item2.clas]" :style="[style(item2)]" :key="index2">
|
|
8
|
+
<view v-for="(item3,index3) in item2.elements" :key="index3">
|
|
9
|
+
<!-- 垂直高度站位 -->
|
|
10
|
+
<view :style="{height: $uv.addUnit(item3.height,'rpx')}" v-if="item3.type=='gap'"></view>
|
|
11
|
+
<view :class="[item3.clas, roundClass, animateClass]" :style="[style(item3)]" v-else ref="skeleton"></view>
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
<!-- 自定义骨架屏内容 -->
|
|
16
|
+
<!-- ps 自定义扩展说明: -->
|
|
17
|
+
<!-- 如果你需要自定义模板,可以参照这个custom的写法,增加一个skeleton配置类型,编写布局和样式就可以了 -->
|
|
18
|
+
<!-- 注意事项:为了保证骨架效果和动态效果的一致,扩展时,在你希望实际展示在页面中的元素上加上 :class="[style, animateClass]" 和 :style="[style(item)]" 和 ref="skeleton" -->
|
|
19
|
+
<view :class="[item.clas, animateClass]" :style="[style(item)]" ref="skeleton" v-else-if="item.type == 'custom'"></view>
|
|
20
|
+
<!-- 垂直高度站位 -->
|
|
21
|
+
<view :style="{height: $uv.addUnit(item.height,'rpx')}" v-else-if="item.type=='gap'"></view>
|
|
22
|
+
<!-- 其他基本单位 line avatar 等 -->
|
|
23
|
+
<view :class="[item.clas, roundClass, animateClass]" :style="[style(item)]" v-else ref="skeleton"></view>
|
|
24
|
+
</view>
|
|
25
|
+
</view>
|
|
26
|
+
<view v-else>
|
|
27
|
+
<slot />
|
|
28
|
+
</view>
|
|
29
|
+
</view>
|
|
30
|
+
</template>
|
|
31
|
+
<script>
|
|
32
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
33
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
34
|
+
// #ifdef APP-NVUE
|
|
35
|
+
const animation = weex.requireModule('animation');
|
|
36
|
+
// #endif
|
|
37
|
+
export default {
|
|
38
|
+
name: 'uv-skeletons',
|
|
39
|
+
mixins: [mpMixin, mixin],
|
|
40
|
+
props: {
|
|
41
|
+
// 是否显示骨架
|
|
42
|
+
loading: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: true
|
|
45
|
+
},
|
|
46
|
+
// 骨架内容 具体说明参考文档:
|
|
47
|
+
skeleton: {
|
|
48
|
+
type: Array,
|
|
49
|
+
default: () => []
|
|
50
|
+
},
|
|
51
|
+
// 是否开启动画效果
|
|
52
|
+
animate: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
55
|
+
},
|
|
56
|
+
// 是否圆角骨架风格
|
|
57
|
+
round: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
...uni.$uv?.props?.skeleton
|
|
62
|
+
},
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
elements: [],
|
|
66
|
+
opacity: 0.5,
|
|
67
|
+
duration: 600
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
animateClass() {
|
|
72
|
+
return this.animate ? 'uv-skeleton--animation' : 'uv-skeleton--static';
|
|
73
|
+
},
|
|
74
|
+
roundClass() {
|
|
75
|
+
return this.round ? 'uv-skeleton--round' : 'uv-skeleton--radius';
|
|
76
|
+
},
|
|
77
|
+
style(item) {
|
|
78
|
+
return item => {
|
|
79
|
+
const style = {};
|
|
80
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(item.style));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
created() {
|
|
85
|
+
this.init();
|
|
86
|
+
// #ifdef APP-NVUE
|
|
87
|
+
if (this.loading && this.animate) {
|
|
88
|
+
this.$uv.sleep(50).then(res => {
|
|
89
|
+
this.createAnimation(this.opacity);
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
// #endif
|
|
93
|
+
},
|
|
94
|
+
methods: {
|
|
95
|
+
/**
|
|
96
|
+
* 初始化数据
|
|
97
|
+
*/
|
|
98
|
+
init() {
|
|
99
|
+
let elements = [];
|
|
100
|
+
if (!this.$uv.test.array(this.skeleton)) return this.$uv.error('skeleton参数必须为数组形式,参考文档示例:');
|
|
101
|
+
this.skeleton.forEach(el => {
|
|
102
|
+
const elClass = this.getElCounts(el);
|
|
103
|
+
elements = elements.concat(elClass);
|
|
104
|
+
})
|
|
105
|
+
this.elements = [...elements];
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* 处理骨架屏参数内容
|
|
109
|
+
* @param {Object} el 每项数据
|
|
110
|
+
*/
|
|
111
|
+
getElCounts(el) {
|
|
112
|
+
let elements = [];
|
|
113
|
+
let children = [];
|
|
114
|
+
if (this.$uv.test.number(el)) {
|
|
115
|
+
elements.push({
|
|
116
|
+
type: 'gap',
|
|
117
|
+
height: el
|
|
118
|
+
});
|
|
119
|
+
return elements;
|
|
120
|
+
} else {
|
|
121
|
+
const type = el.type ? el.type : 'line';
|
|
122
|
+
const num = el.num ? el.num : 1;
|
|
123
|
+
const style = el.style ? el.style : {};
|
|
124
|
+
const styleIsArray = this.$uv.test.array(style);
|
|
125
|
+
const gap = el.gap ? el.gap : '20rpx';
|
|
126
|
+
const child = el.children ? el.children : [];
|
|
127
|
+
for (let i = 0; i < child.length; i++) {
|
|
128
|
+
children[i] = {
|
|
129
|
+
clas: child[i].type.indexOf('avatar') > -1 || child[i].type.indexOf('custom') > -1 ? '' : 'uv-skeleton__group__sub',
|
|
130
|
+
elements: this.getElCounts(child[i])
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
for (let i = 0; i < num; i++) {
|
|
134
|
+
if (gap && i < num && i > 0) {
|
|
135
|
+
elements.push({
|
|
136
|
+
type: 'gap',
|
|
137
|
+
height: gap
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
elements.push({
|
|
141
|
+
clas: `uv-skeleton__${type}`,
|
|
142
|
+
type,
|
|
143
|
+
style: styleIsArray ? style[i] : style,
|
|
144
|
+
gap,
|
|
145
|
+
children
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return elements;
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* 创建动画
|
|
153
|
+
*/
|
|
154
|
+
createAnimation(opacity = 1) {
|
|
155
|
+
// loading结束之后或未开启动画不执行
|
|
156
|
+
if (!this.loading || !this.animate) return;
|
|
157
|
+
let count = 0;
|
|
158
|
+
const skeletons = this.$refs.skeleton;
|
|
159
|
+
skeletons.forEach(item => {
|
|
160
|
+
animation.transition(item, {
|
|
161
|
+
styles: {
|
|
162
|
+
opacity: opacity,
|
|
163
|
+
},
|
|
164
|
+
duration: this.duration
|
|
165
|
+
}, () => {
|
|
166
|
+
count++;
|
|
167
|
+
if (count >= skeletons.length) {
|
|
168
|
+
setTimeout(() => {
|
|
169
|
+
this.createAnimation(opacity < 1 ? 1 : this.opacity);
|
|
170
|
+
}, 200)
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
</script>
|
|
178
|
+
<style scoped lang="scss">
|
|
179
|
+
@import '../../libs/css/components.scss';
|
|
180
|
+
@mixin background {
|
|
181
|
+
/* #ifdef APP-NVUE */
|
|
182
|
+
background-color: #e6e6e6;
|
|
183
|
+
/* #endif */
|
|
184
|
+
/* #ifndef APP-NVUE */
|
|
185
|
+
background: linear-gradient(90deg, #F1F2F4 25%, #e6e6e6 37%, #F1F2F4 50%);
|
|
186
|
+
background-size: 400% 100%;
|
|
187
|
+
/* #endif */
|
|
188
|
+
}
|
|
189
|
+
.uv-skeleton__line {
|
|
190
|
+
height: 32rpx;
|
|
191
|
+
// margin-bottom: 30rpx;
|
|
192
|
+
}
|
|
193
|
+
.uv-skeleton__line--sm {
|
|
194
|
+
height: 24rpx;
|
|
195
|
+
margin-bottom: 30rpx;
|
|
196
|
+
}
|
|
197
|
+
.uv-skeleton__line--lg {
|
|
198
|
+
height: 48rpx;
|
|
199
|
+
margin-bottom: 30rpx;
|
|
200
|
+
}
|
|
201
|
+
.uv-skeleton--static {
|
|
202
|
+
@include background;
|
|
203
|
+
}
|
|
204
|
+
.uv-skeleton--radius {
|
|
205
|
+
border-radius: 8rpx;
|
|
206
|
+
}
|
|
207
|
+
.uv-skeleton--round {
|
|
208
|
+
border-radius: 30rpx;
|
|
209
|
+
}
|
|
210
|
+
.uv-skeleton__avatar {
|
|
211
|
+
width: 100rpx;
|
|
212
|
+
height: 100rpx;
|
|
213
|
+
border-radius: 50rpx;
|
|
214
|
+
}
|
|
215
|
+
.uv-skeleton__avatar--sm {
|
|
216
|
+
width: 50rpx;
|
|
217
|
+
height: 50rpx;
|
|
218
|
+
border-radius: 25rpx;
|
|
219
|
+
}
|
|
220
|
+
.uv-skeleton__avatar--lg {
|
|
221
|
+
width: 200rpx;
|
|
222
|
+
height: 200rpx;
|
|
223
|
+
border-radius: 100rpx;
|
|
224
|
+
}
|
|
225
|
+
.uv-skeleton__group {
|
|
226
|
+
@include flex;
|
|
227
|
+
&__sub {
|
|
228
|
+
flex: 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
.uv-skeleton--animation {
|
|
232
|
+
@include background;
|
|
233
|
+
/* #ifndef APP-NVUE */
|
|
234
|
+
animation: skeleton 1.8s ease infinite
|
|
235
|
+
/* #endif */
|
|
236
|
+
}
|
|
237
|
+
/* #ifndef APP-NVUE */
|
|
238
|
+
@keyframes skeleton {
|
|
239
|
+
0% {
|
|
240
|
+
background-position: 100% 50%
|
|
241
|
+
}
|
|
242
|
+
100% {
|
|
243
|
+
background-position: 0 50%
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/* #endif */
|
|
247
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
value: {
|
|
4
|
+
type: [Number, String],
|
|
5
|
+
default: 0
|
|
6
|
+
},
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: [Number, String],
|
|
9
|
+
default: 0
|
|
10
|
+
},
|
|
11
|
+
// 最小可选值
|
|
12
|
+
min: {
|
|
13
|
+
type: [Number, String],
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
// 最大可选值
|
|
17
|
+
max: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 100
|
|
20
|
+
},
|
|
21
|
+
// 步长,取值必须大于 0,并且可被(max - min)整除
|
|
22
|
+
step: {
|
|
23
|
+
type: [Number, String],
|
|
24
|
+
default: 1
|
|
25
|
+
},
|
|
26
|
+
// 滑块右侧已选择部分的背景色
|
|
27
|
+
activeColor: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: '#2979ff'
|
|
30
|
+
},
|
|
31
|
+
// 滑块左侧未选择部分的背景色
|
|
32
|
+
backgroundColor: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '#c0c4cc'
|
|
35
|
+
},
|
|
36
|
+
// 滑块的大小,取值范围为 12 - 28
|
|
37
|
+
blockSize: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: 18
|
|
40
|
+
},
|
|
41
|
+
// 滑块的颜色
|
|
42
|
+
blockColor: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '#ffffff'
|
|
45
|
+
},
|
|
46
|
+
// 禁用状态
|
|
47
|
+
disabled: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
// 是否显示当前的选择值
|
|
52
|
+
showValue: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
...uni.$uv?.props?.slider
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-slider"
|
|
4
|
+
:style="[$uv.addStyle(customStyle)]"
|
|
5
|
+
>
|
|
6
|
+
<slider
|
|
7
|
+
:min="min"
|
|
8
|
+
:max="max"
|
|
9
|
+
:step="step"
|
|
10
|
+
:value="sliderValue"
|
|
11
|
+
:activeColor="activeColor"
|
|
12
|
+
:backgroundColor="backgroundColor"
|
|
13
|
+
:blockSize="$uv.getPx(blockSize)"
|
|
14
|
+
:blockColor="blockColor"
|
|
15
|
+
:showValue="showValue"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
@changing="changingHandler"
|
|
18
|
+
@change="changeHandler"
|
|
19
|
+
></slider>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
24
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
25
|
+
import props from './props.js'
|
|
26
|
+
export default {
|
|
27
|
+
name: 'uv-slider',
|
|
28
|
+
mixins: [mpMixin, mixin, props],
|
|
29
|
+
computed: {
|
|
30
|
+
sliderValue(){
|
|
31
|
+
return this.value || this.modelValue;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
// 拖动过程中触发
|
|
36
|
+
changingHandler(e) {
|
|
37
|
+
const { value } = e.detail
|
|
38
|
+
// 更新v-model的值
|
|
39
|
+
this.$emit('input', value)
|
|
40
|
+
this.$emit('update:modelValue',value)
|
|
41
|
+
// 触发事件
|
|
42
|
+
this.$emit('changing', value)
|
|
43
|
+
},
|
|
44
|
+
// 滑动结束时触发
|
|
45
|
+
changeHandler(e) {
|
|
46
|
+
const {
|
|
47
|
+
value
|
|
48
|
+
} = e.detail
|
|
49
|
+
// 更新v-model的值
|
|
50
|
+
this.$emit('input', value)
|
|
51
|
+
this.$emit('update:modelValue',value)
|
|
52
|
+
// 触发事件
|
|
53
|
+
this.$emit('change', value)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|