@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
|
+
// radio的名称
|
|
4
|
+
name: {
|
|
5
|
+
type: [String, Number, Boolean],
|
|
6
|
+
default: ''
|
|
7
|
+
},
|
|
8
|
+
// 形状,square为方形,circle为圆型
|
|
9
|
+
shape: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: ''
|
|
12
|
+
},
|
|
13
|
+
// 是否禁用
|
|
14
|
+
disabled: {
|
|
15
|
+
type: [String, Boolean],
|
|
16
|
+
default: ''
|
|
17
|
+
},
|
|
18
|
+
// 是否禁止点击提示语选中单选框
|
|
19
|
+
labelDisabled: {
|
|
20
|
+
type: [String, Boolean],
|
|
21
|
+
default: ''
|
|
22
|
+
},
|
|
23
|
+
// 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值
|
|
24
|
+
activeColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: ''
|
|
27
|
+
},
|
|
28
|
+
// 未选中的颜色
|
|
29
|
+
inactiveColor: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
// 图标的大小,单位px
|
|
34
|
+
iconSize: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: ''
|
|
37
|
+
},
|
|
38
|
+
// label的字体大小,px单位
|
|
39
|
+
labelSize: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
default: ''
|
|
42
|
+
},
|
|
43
|
+
// label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式
|
|
44
|
+
label: {
|
|
45
|
+
type: [String, Number, Boolean],
|
|
46
|
+
default: ''
|
|
47
|
+
},
|
|
48
|
+
// 整体的大小
|
|
49
|
+
size: {
|
|
50
|
+
type: [String, Number],
|
|
51
|
+
default: ''
|
|
52
|
+
},
|
|
53
|
+
// 图标颜色
|
|
54
|
+
iconColor: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: ''
|
|
57
|
+
},
|
|
58
|
+
// label的颜色
|
|
59
|
+
labelColor: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ''
|
|
62
|
+
},
|
|
63
|
+
...uni.$uv?.props?.radio
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-radio"
|
|
4
|
+
@tap.stop="wrapperClickHandler"
|
|
5
|
+
:style="[radioStyle]"
|
|
6
|
+
:class="[`uv-radio-label--${parentData.iconPlacement}`, parentData.borderBottom && parentData.placement === 'column' && 'uv-border-bottom']"
|
|
7
|
+
>
|
|
8
|
+
<view
|
|
9
|
+
class="uv-radio__icon-wrap"
|
|
10
|
+
@tap.stop="iconClickHandler"
|
|
11
|
+
:class="iconClasses"
|
|
12
|
+
:style="[iconWrapStyle]"
|
|
13
|
+
>
|
|
14
|
+
<slot name="icon">
|
|
15
|
+
<uv-icon
|
|
16
|
+
class="uv-radio__icon-wrap__icon"
|
|
17
|
+
name="checkbox-mark"
|
|
18
|
+
:size="elIconSize"
|
|
19
|
+
:color="elIconColor"
|
|
20
|
+
/>
|
|
21
|
+
</slot>
|
|
22
|
+
</view>
|
|
23
|
+
<view
|
|
24
|
+
v-if="label !== false"
|
|
25
|
+
class="uv-radio__label-wrap"
|
|
26
|
+
@tap.stop="labelClickHandler">
|
|
27
|
+
<slot>
|
|
28
|
+
<text
|
|
29
|
+
:style="{
|
|
30
|
+
color: elDisabled ? elInactiveColor : elLabelColor,
|
|
31
|
+
fontSize: elLabelSize,
|
|
32
|
+
lineHeight: elLabelSize
|
|
33
|
+
}"
|
|
34
|
+
>{{label}}</text>
|
|
35
|
+
</slot>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</template>
|
|
39
|
+
<script>
|
|
40
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
41
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
42
|
+
import props from './props.js';
|
|
43
|
+
/**
|
|
44
|
+
* radio 单选框
|
|
45
|
+
* @description 单选框用于有一个选择,用户只能选择其中一个的场景。搭配uv-radio-group使用
|
|
46
|
+
* @tutorial https://www.uvui.cn/components/radio.html
|
|
47
|
+
* @property {String | Number} name radio的名称
|
|
48
|
+
* @property {String} shape 形状,square为方形,circle为圆型
|
|
49
|
+
* @property {Boolean} disabled 是否禁用
|
|
50
|
+
* @property {String | Boolean} labelDisabled 是否禁止点击提示语选中单选框
|
|
51
|
+
* @property {String} activeColor 选中时的颜色,如设置parent的active-color将失效
|
|
52
|
+
* @property {String} inactiveColor 未选中的颜色
|
|
53
|
+
* @property {String | Number} iconSize 图标大小,单位px
|
|
54
|
+
* @property {String | Number} labelSize label字体大小,单位px
|
|
55
|
+
* @property {String | Number} label label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式
|
|
56
|
+
* @property {String | Number} size 整体的大小
|
|
57
|
+
* @property {String} iconColor 图标颜色
|
|
58
|
+
* @property {String} labelColor label的颜色
|
|
59
|
+
* @property {Object} customStyle 组件的样式,对象形式
|
|
60
|
+
*
|
|
61
|
+
* @event {Function} change 某个radio状态发生变化时触发(选中状态)
|
|
62
|
+
* @example <uv-radio :labelDisabled="false">门掩黄昏,无计留春住</uv-radio>
|
|
63
|
+
*/
|
|
64
|
+
export default {
|
|
65
|
+
name: "uv-radio",
|
|
66
|
+
|
|
67
|
+
mixins: [mpMixin, mixin, props],
|
|
68
|
+
data() {
|
|
69
|
+
return {
|
|
70
|
+
checked: false,
|
|
71
|
+
// 当你看到这段代码的时候,
|
|
72
|
+
// 父组件的默认值,因为头条小程序不支持在computed中使用this.parent.shape的形式
|
|
73
|
+
// 故只能使用如此方法
|
|
74
|
+
parentData: {
|
|
75
|
+
iconSize: 12,
|
|
76
|
+
labelSize: 14,
|
|
77
|
+
labelColor: '#303133',
|
|
78
|
+
labelDisabled: null,
|
|
79
|
+
disabled: null,
|
|
80
|
+
shape: null,
|
|
81
|
+
activeColor: null,
|
|
82
|
+
inactiveColor: null,
|
|
83
|
+
size: 18,
|
|
84
|
+
value: null,
|
|
85
|
+
modelValue: null,
|
|
86
|
+
iconColor: null,
|
|
87
|
+
placement: 'row',
|
|
88
|
+
borderBottom: false,
|
|
89
|
+
iconPlacement: 'left'
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computed: {
|
|
94
|
+
// 是否禁用,如果父组件uv-raios-group禁用的话,将会忽略子组件的配置
|
|
95
|
+
elDisabled() {
|
|
96
|
+
return this.disabled !== '' ? this.disabled : this.parentData.disabled !== null ? this.parentData.disabled : false;
|
|
97
|
+
},
|
|
98
|
+
// 是否禁用label点击
|
|
99
|
+
elLabelDisabled() {
|
|
100
|
+
return this.labelDisabled !== '' ? this.labelDisabled : this.parentData.labelDisabled !== null ? this.parentData.labelDisabled :
|
|
101
|
+
false;
|
|
102
|
+
},
|
|
103
|
+
// 组件尺寸,对应size的值,默认值为21px
|
|
104
|
+
elSize() {
|
|
105
|
+
return this.size ? this.size : (this.parentData.size ? this.parentData.size : 21);
|
|
106
|
+
},
|
|
107
|
+
// 组件的勾选图标的尺寸,默认12px
|
|
108
|
+
elIconSize() {
|
|
109
|
+
return this.iconSize ? this.iconSize : (this.parentData.iconSize ? this.parentData.iconSize : 12);
|
|
110
|
+
},
|
|
111
|
+
// 组件选中激活时的颜色
|
|
112
|
+
elActiveColor() {
|
|
113
|
+
return this.activeColor ? this.activeColor : (this.parentData.activeColor ? this.parentData.activeColor : '#2979ff');
|
|
114
|
+
},
|
|
115
|
+
// 组件选未中激活时的颜色
|
|
116
|
+
elInactiveColor() {
|
|
117
|
+
return this.inactiveColor ? this.inactiveColor : (this.parentData.inactiveColor ? this.parentData.inactiveColor :
|
|
118
|
+
'#c8c9cc');
|
|
119
|
+
},
|
|
120
|
+
// label的颜色
|
|
121
|
+
elLabelColor() {
|
|
122
|
+
return this.labelColor ? this.labelColor : (this.parentData.labelColor ? this.parentData.labelColor : '#606266')
|
|
123
|
+
},
|
|
124
|
+
// 组件的形状
|
|
125
|
+
elShape() {
|
|
126
|
+
return this.shape ? this.shape : (this.parentData.shape ? this.parentData.shape : 'circle');
|
|
127
|
+
},
|
|
128
|
+
// label大小
|
|
129
|
+
elLabelSize() {
|
|
130
|
+
return this.$uv.addUnit(this.labelSize ? this.labelSize : (this.parentData.labelSize ? this.parentData.labelSize :
|
|
131
|
+
'15'))
|
|
132
|
+
},
|
|
133
|
+
elIconColor() {
|
|
134
|
+
const iconColor = this.iconColor ? this.iconColor : (this.parentData.iconColor ? this.parentData.iconColor :
|
|
135
|
+
'#ffffff');
|
|
136
|
+
// 图标的颜色
|
|
137
|
+
if (this.elDisabled) {
|
|
138
|
+
// disabled状态下,已勾选的radio图标改为elInactiveColor
|
|
139
|
+
return this.checked ? this.elInactiveColor : 'transparent'
|
|
140
|
+
} else {
|
|
141
|
+
return this.checked ? iconColor : 'transparent'
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
iconClasses() {
|
|
145
|
+
let classes = []
|
|
146
|
+
// 组件的形状
|
|
147
|
+
classes.push('uv-radio__icon-wrap--' + this.elShape)
|
|
148
|
+
if (this.elDisabled) {
|
|
149
|
+
classes.push('uv-radio__icon-wrap--disabled')
|
|
150
|
+
}
|
|
151
|
+
if (this.checked && this.elDisabled) {
|
|
152
|
+
classes.push('uv-radio__icon-wrap--disabled--checked')
|
|
153
|
+
}
|
|
154
|
+
// 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
|
|
155
|
+
// #ifdef MP-ALIPAY || MP-TOUTIAO
|
|
156
|
+
classes = classes.join(' ')
|
|
157
|
+
// #endif
|
|
158
|
+
return classes
|
|
159
|
+
},
|
|
160
|
+
iconWrapStyle() {
|
|
161
|
+
// radio的整体样式
|
|
162
|
+
const style = {}
|
|
163
|
+
style.backgroundColor = this.checked && !this.elDisabled ? this.elActiveColor : '#ffffff'
|
|
164
|
+
style.borderColor = this.checked && !this.elDisabled ? this.elActiveColor : this.elInactiveColor
|
|
165
|
+
style.width = this.$uv.addUnit(this.elSize)
|
|
166
|
+
style.height = this.$uv.addUnit(this.elSize)
|
|
167
|
+
// 如果是图标在右边的话,移除它的右边距
|
|
168
|
+
if (this.parentData.iconPlacement === 'right') {
|
|
169
|
+
style.marginRight = 0
|
|
170
|
+
}
|
|
171
|
+
return style
|
|
172
|
+
},
|
|
173
|
+
radioStyle() {
|
|
174
|
+
const style = {}
|
|
175
|
+
if (this.parentData.borderBottom && this.parentData.placement === 'row') {
|
|
176
|
+
this.$uv.error('检测到您将borderBottom设置为true,需要同时将uv-radio-group的placement设置为column才有效')
|
|
177
|
+
}
|
|
178
|
+
// 当父组件设置了显示下边框并且排列形式为纵向时,给内容和边框之间加上一定间隔
|
|
179
|
+
if (this.parentData.borderBottom && this.parentData.placement === 'column') {
|
|
180
|
+
// ios像素密度高,需要多一点的距离
|
|
181
|
+
style.paddingBottom = this.$uv.os() === 'ios' ? '12px' : '8px'
|
|
182
|
+
}
|
|
183
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
created() {
|
|
187
|
+
this.init()
|
|
188
|
+
},
|
|
189
|
+
methods: {
|
|
190
|
+
init() {
|
|
191
|
+
// 支付宝小程序不支持provide/inject,所以使用这个方法获取整个父组件,在created定义,避免循环引用
|
|
192
|
+
this.updateParentData()
|
|
193
|
+
if (!this.parent) {
|
|
194
|
+
this.$uv.error('uv-radio必须搭配uv-radio-group组件使用')
|
|
195
|
+
}
|
|
196
|
+
// 设置初始化时,是否默认选中的状态
|
|
197
|
+
this.$nextTick(()=>{
|
|
198
|
+
let parentValue = null;
|
|
199
|
+
// #ifdef VUE2
|
|
200
|
+
parentValue = this.parentData.value;
|
|
201
|
+
// #endif
|
|
202
|
+
// #ifdef VUE3
|
|
203
|
+
parentValue = this.parentData.modelValue;
|
|
204
|
+
// #endif
|
|
205
|
+
this.checked = this.name === parentValue
|
|
206
|
+
})
|
|
207
|
+
},
|
|
208
|
+
updateParentData() {
|
|
209
|
+
this.getParentData('uv-radio-group')
|
|
210
|
+
},
|
|
211
|
+
// 点击图标
|
|
212
|
+
iconClickHandler(e) {
|
|
213
|
+
this.preventEvent(e)
|
|
214
|
+
// 如果整体被禁用,不允许被点击
|
|
215
|
+
if (!this.elDisabled) {
|
|
216
|
+
this.setRadioCheckedStatus()
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
// 横向两端排列时,点击组件即可触发选中事件
|
|
220
|
+
wrapperClickHandler(e) {
|
|
221
|
+
this.parentData.iconPlacement === 'right' && this.iconClickHandler(e)
|
|
222
|
+
},
|
|
223
|
+
// 点击label
|
|
224
|
+
labelClickHandler(e) {
|
|
225
|
+
this.preventEvent(e)
|
|
226
|
+
// 如果按钮整体被禁用或者label被禁用,则不允许点击文字修改状态
|
|
227
|
+
if (!this.elLabelDisabled && !this.elDisabled) {
|
|
228
|
+
this.setRadioCheckedStatus()
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
emitEvent() {
|
|
232
|
+
// uv-radio的checked不为true时(意味着未选中),才发出事件,避免多次点击触发事件
|
|
233
|
+
if (!this.checked) {
|
|
234
|
+
this.$emit('change', this.name)
|
|
235
|
+
// 尝试调用uv-form的验证方法,进行一定延迟,否则微信小程序更新可能会不及时
|
|
236
|
+
this.$nextTick(() => {
|
|
237
|
+
this.$uv.formValidate(this, 'change')
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
// 改变组件选中状态
|
|
242
|
+
// 这里的改变的依据是,更改本组件的checked值为true,同时通过父组件遍历所有uv-radio实例
|
|
243
|
+
// 将本组件外的其他uv-radio的checked都设置为false(都被取消选中状态),因而只剩下一个为选中状态
|
|
244
|
+
setRadioCheckedStatus() {
|
|
245
|
+
this.emitEvent()
|
|
246
|
+
// 将本组件标记为选中状态
|
|
247
|
+
this.checked = true
|
|
248
|
+
typeof this.parent.unCheckedOther === 'function' && this.parent.unCheckedOther(this)
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
</script>
|
|
253
|
+
|
|
254
|
+
<style lang="scss" scoped>
|
|
255
|
+
$show-border: 1;
|
|
256
|
+
$show-border-bottom: 1;
|
|
257
|
+
@import '../../libs/css/variable.scss';
|
|
258
|
+
@import '../../libs/css/components.scss';
|
|
259
|
+
@import '../../libs/css/color.scss';
|
|
260
|
+
$uv-radio-label-wrap-padding-right: 6px !default;
|
|
261
|
+
$uv-radio-wrap-font-size: 20px !default;
|
|
262
|
+
$uv-radio-wrap-border-width: 1px !default;
|
|
263
|
+
$uv-radio-wrap-border-color: #c8c9cc !default;
|
|
264
|
+
$uv-radio-line-height: 0 !default;
|
|
265
|
+
$uv-radio-circle-border-radius: 100% !default;
|
|
266
|
+
$uv-radio-square-border-radius: 3px !default;
|
|
267
|
+
$uv-radio-checked-color: #fff !default;
|
|
268
|
+
$uv-radio-checked-background-color: red !default;
|
|
269
|
+
$uv-radio-checked-border-color: #2979ff !default;
|
|
270
|
+
$uv-radio-disabled-background-color: #ebedf0 !default;
|
|
271
|
+
$uv-radio-disabled--checked-color: #c8c9cc !default;
|
|
272
|
+
$uv-radio-label-margin-left: 5px !default;
|
|
273
|
+
$uv-radio-label-margin-right: 12px !default;
|
|
274
|
+
$uv-radio-label-color: $uv-content-color !default;
|
|
275
|
+
$uv-radio-label-font-size: 15px !default;
|
|
276
|
+
$uv-radio-label-disabled-color: #c8c9cc !default;
|
|
277
|
+
.uv-radio {
|
|
278
|
+
/* #ifndef APP-NVUE */
|
|
279
|
+
@include flex(row);
|
|
280
|
+
/* #endif */
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
flex-direction: row;
|
|
283
|
+
align-items: center;
|
|
284
|
+
&-label--left {
|
|
285
|
+
flex-direction: row
|
|
286
|
+
}
|
|
287
|
+
&-label--right {
|
|
288
|
+
flex-direction: row-reverse;
|
|
289
|
+
justify-content: space-between
|
|
290
|
+
}
|
|
291
|
+
&__icon-wrap {
|
|
292
|
+
/* #ifndef APP-NVUE */
|
|
293
|
+
box-sizing: border-box;
|
|
294
|
+
// nvue下,border-color过渡有问题
|
|
295
|
+
transition-property: border-color, background-color, color;
|
|
296
|
+
transition-duration: 0.2s;
|
|
297
|
+
/* #endif */
|
|
298
|
+
color: $uv-content-color;
|
|
299
|
+
@include flex;
|
|
300
|
+
align-items: center;
|
|
301
|
+
justify-content: center;
|
|
302
|
+
color: transparent;
|
|
303
|
+
text-align: center;
|
|
304
|
+
font-size: $uv-radio-wrap-font-size;
|
|
305
|
+
border-width: $uv-radio-wrap-border-width;
|
|
306
|
+
border-color: $uv-radio-wrap-border-color;
|
|
307
|
+
border-style: solid;
|
|
308
|
+
/* #ifdef MP-TOUTIAO */
|
|
309
|
+
// 头条小程序兼容性问题,需要设置行高为0,否则图标偏下
|
|
310
|
+
&__icon {
|
|
311
|
+
line-height: $uv-radio-line-height;
|
|
312
|
+
}
|
|
313
|
+
/* #endif */
|
|
314
|
+
&--circle {
|
|
315
|
+
border-radius: $uv-radio-circle-border-radius;
|
|
316
|
+
}
|
|
317
|
+
&--square {
|
|
318
|
+
border-radius: $uv-radio-square-border-radius;
|
|
319
|
+
}
|
|
320
|
+
&--checked {
|
|
321
|
+
color: $uv-radio-checked-color;
|
|
322
|
+
background-color: $uv-radio-checked-background-color;
|
|
323
|
+
border-color: $uv-radio-checked-border-color;
|
|
324
|
+
}
|
|
325
|
+
&--disabled {
|
|
326
|
+
background-color: $uv-radio-disabled-background-color !important;
|
|
327
|
+
}
|
|
328
|
+
&--disabled--checked {
|
|
329
|
+
color: $uv-radio-disabled--checked-color !important;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
&__label {
|
|
333
|
+
/* #ifndef APP-NVUE */
|
|
334
|
+
word-wrap: break-word;
|
|
335
|
+
/* #endif */
|
|
336
|
+
margin-left: $uv-radio-label-margin-left;
|
|
337
|
+
margin-right: $uv-radio-label-margin-right;
|
|
338
|
+
color: $uv-radio-label-color;
|
|
339
|
+
font-size: $uv-radio-label-font-size;
|
|
340
|
+
&--disabled {
|
|
341
|
+
color: $uv-radio-label-disabled-color;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
&__label-wrap {
|
|
345
|
+
flex: 1;
|
|
346
|
+
padding-left: $uv-radio-label-wrap-padding-right;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 绑定的值
|
|
4
|
+
value: {
|
|
5
|
+
type: [String, Number, Boolean],
|
|
6
|
+
default: ''
|
|
7
|
+
},
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: [String, Number, Boolean],
|
|
10
|
+
default: ''
|
|
11
|
+
},
|
|
12
|
+
// 是否禁用全部radio
|
|
13
|
+
disabled: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
// 形状,circle-圆形,square-方形
|
|
18
|
+
shape: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'circle'
|
|
21
|
+
},
|
|
22
|
+
// 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值
|
|
23
|
+
activeColor: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: '#2979ff'
|
|
26
|
+
},
|
|
27
|
+
// 未选中的颜色
|
|
28
|
+
inactiveColor: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: '#c8c9cc'
|
|
31
|
+
},
|
|
32
|
+
// 标识符
|
|
33
|
+
name: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ''
|
|
36
|
+
},
|
|
37
|
+
// 整个组件的尺寸,默认px
|
|
38
|
+
size: {
|
|
39
|
+
type: [String, Number],
|
|
40
|
+
default: 18
|
|
41
|
+
},
|
|
42
|
+
// 布局方式,row-横向,column-纵向
|
|
43
|
+
placement: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'row'
|
|
46
|
+
},
|
|
47
|
+
// label的文本
|
|
48
|
+
label: {
|
|
49
|
+
type: [String],
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
52
|
+
// label的颜色 (默认 '#303133' )
|
|
53
|
+
labelColor: {
|
|
54
|
+
type: [String],
|
|
55
|
+
default: '#303133'
|
|
56
|
+
},
|
|
57
|
+
// label的字体大小,px单位
|
|
58
|
+
labelSize: {
|
|
59
|
+
type: [String, Number],
|
|
60
|
+
default: 14
|
|
61
|
+
},
|
|
62
|
+
// 是否禁止点击文本操作checkbox(默认 false )
|
|
63
|
+
labelDisabled: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
// 图标颜色
|
|
68
|
+
iconColor: {
|
|
69
|
+
type: String,
|
|
70
|
+
default: '#fff'
|
|
71
|
+
},
|
|
72
|
+
// 图标的大小,单位px
|
|
73
|
+
iconSize: {
|
|
74
|
+
type: [String, Number],
|
|
75
|
+
default: 12
|
|
76
|
+
},
|
|
77
|
+
// 竖向配列时,是否显示下划线
|
|
78
|
+
borderBottom: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
// 图标与文字的对齐方式
|
|
83
|
+
iconPlacement: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: 'left'
|
|
86
|
+
},
|
|
87
|
+
...uni.$uv?.props?.radioGroup
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-radio-group"
|
|
4
|
+
:class="bemClass"
|
|
5
|
+
:style="[$uv.addStyle(this.customStyle)]"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</view>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
13
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
14
|
+
import props from './props.js';
|
|
15
|
+
/**
|
|
16
|
+
* radioRroup 单选框父组件
|
|
17
|
+
* @description 单选框用于有一个选择,用户只能选择其中一个的场景。搭配uv-radio使用
|
|
18
|
+
* @tutorial https://www.uvui.cn/components/radio.html
|
|
19
|
+
* @property {String | Number | Boolean} value 绑定的值
|
|
20
|
+
* @property {Boolean} disabled 是否禁用所有radio(默认 false )
|
|
21
|
+
* @property {String} shape 外观形状,shape-方形,circle-圆形(默认 circle )
|
|
22
|
+
* @property {String} activeColor 选中时的颜色,应用到所有子Radio组件(默认 '#2979ff' )
|
|
23
|
+
* @property {String} inactiveColor 未选中的颜色 (默认 '#c8c9cc' )
|
|
24
|
+
* @property {String} name 标识符
|
|
25
|
+
* @property {String | Number} size 组件整体的大小,单位px(默认 18 )
|
|
26
|
+
* @property {String} placement 布局方式,row-横向,column-纵向 (默认 'row' )
|
|
27
|
+
* @property {String} label 文本
|
|
28
|
+
* @property {String} labelColor label的颜色 (默认 '#303133' )
|
|
29
|
+
* @property {String | Number} labelSize label的字体大小,px单位 (默认 14 )
|
|
30
|
+
* @property {Boolean} labelDisabled 是否禁止点击文本操作checkbox(默认 false )
|
|
31
|
+
* @property {String} iconColor 图标颜色 (默认 '#ffffff' )
|
|
32
|
+
* @property {String | Number} iconSize 图标的大小,单位px (默认 12 )
|
|
33
|
+
* @property {Boolean} borderBottom placement为row时,是否显示下边框 (默认 false )
|
|
34
|
+
* @property {String} iconPlacement 图标与文字的对齐方式 (默认 'left' )
|
|
35
|
+
* @property {Object} customStyle 组件的样式,对象形式
|
|
36
|
+
* @event {Function} change 任一个radio状态发生变化时触发
|
|
37
|
+
* @example <uv-radio-group v-model="value"></uv-radio-group>
|
|
38
|
+
*/
|
|
39
|
+
export default {
|
|
40
|
+
name: 'uv-radio-group',
|
|
41
|
+
mixins: [mpMixin, mixin, props],
|
|
42
|
+
computed: {
|
|
43
|
+
// 这里computed的变量,都是子组件uv-radio需要用到的,由于头条小程序的兼容性差异,子组件无法实时监听父组件参数的变化
|
|
44
|
+
// 所以需要手动通知子组件,这里返回一个parentData变量,供watch监听,在其中去通知每一个子组件重新从父组件(uv-radio-group)
|
|
45
|
+
// 拉取父组件新的变化后的参数
|
|
46
|
+
parentData() {
|
|
47
|
+
const value = this.value || this.modelValue;
|
|
48
|
+
return [value, this.disabled, this.inactiveColor, this.activeColor, this.size, this.labelDisabled, this.shape,
|
|
49
|
+
this.iconSize, this.borderBottom, this.placement]
|
|
50
|
+
},
|
|
51
|
+
bemClass() {
|
|
52
|
+
// this.bem为一个computed变量,在mixin中
|
|
53
|
+
return this.bem('radio-group', ['placement'])
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
watch: {
|
|
57
|
+
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
|
|
58
|
+
parentData() {
|
|
59
|
+
if (this.children.length) {
|
|
60
|
+
this.children.map(child => {
|
|
61
|
+
// 判断子组件(uv-radio)如果有init方法的话,就就执行(执行的结果是子组件重新从父组件拉取了最新的值)
|
|
62
|
+
typeof(child.init) === 'function' && child.init()
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
created() {
|
|
73
|
+
this.children = []
|
|
74
|
+
},
|
|
75
|
+
methods: {
|
|
76
|
+
// 将其他的radio设置为未选中的状态
|
|
77
|
+
unCheckedOther(childInstance) {
|
|
78
|
+
this.children.map(child => {
|
|
79
|
+
// 所有子radio中,被操作组件实例的checked的值无需修改
|
|
80
|
+
if (childInstance !== child) {
|
|
81
|
+
child.checked = false
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
const {
|
|
85
|
+
name
|
|
86
|
+
} = childInstance
|
|
87
|
+
// 通过emit事件,设置父组件通过v-model双向绑定的值
|
|
88
|
+
// #ifdef VUE2
|
|
89
|
+
this.$emit('input', name)
|
|
90
|
+
// #endif
|
|
91
|
+
// #ifdef VUE3
|
|
92
|
+
this.$emit('update:modelValue',name)
|
|
93
|
+
// #endif
|
|
94
|
+
// 发出事件
|
|
95
|
+
this.$emit('change', name)
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<style lang="scss" scoped>
|
|
102
|
+
@import '../../libs/css/components.scss';
|
|
103
|
+
.uv-radio-group {
|
|
104
|
+
flex: 1;
|
|
105
|
+
|
|
106
|
+
&--row {
|
|
107
|
+
@include flex;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&--column {
|
|
112
|
+
@include flex(column);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
value: {
|
|
4
|
+
type: [String, Number],
|
|
5
|
+
default: 0
|
|
6
|
+
},
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: [String, Number],
|
|
9
|
+
default: 0
|
|
10
|
+
},
|
|
11
|
+
// 要显示的星星数量
|
|
12
|
+
count: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
default: 5
|
|
15
|
+
},
|
|
16
|
+
// 是否不可选中
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
// 是否只读
|
|
22
|
+
readonly: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
// 星星的大小,单位px
|
|
27
|
+
size: {
|
|
28
|
+
type: [String, Number],
|
|
29
|
+
default: 18
|
|
30
|
+
},
|
|
31
|
+
// 未选中时的颜色
|
|
32
|
+
inactiveColor: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: '#b2b2b2'
|
|
35
|
+
},
|
|
36
|
+
// 选中的颜色
|
|
37
|
+
activeColor: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '#FA3534'
|
|
40
|
+
},
|
|
41
|
+
// 星星之间的间距,单位px
|
|
42
|
+
gutter: {
|
|
43
|
+
type: [String, Number],
|
|
44
|
+
default: 4
|
|
45
|
+
},
|
|
46
|
+
// 最少能选择的星星个数
|
|
47
|
+
minCount: {
|
|
48
|
+
type: [String, Number],
|
|
49
|
+
default: 1
|
|
50
|
+
},
|
|
51
|
+
// 是否允许半星
|
|
52
|
+
allowHalf: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false
|
|
55
|
+
},
|
|
56
|
+
// 选中时的图标(星星)
|
|
57
|
+
activeIcon: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'star-fill'
|
|
60
|
+
},
|
|
61
|
+
// 未选中时的图标(星星)
|
|
62
|
+
inactiveIcon: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: 'star'
|
|
65
|
+
},
|
|
66
|
+
// 是否可以通过滑动手势选择评分
|
|
67
|
+
touchable: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
...uni.$uv?.props?.rate
|
|
72
|
+
}
|
|
73
|
+
}
|