uview-ui-wjf 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +71 -0
- package/changelog.md +388 -0
- package/components/u--form/u--form.vue +92 -0
- package/components/u--image/u--image.vue +73 -0
- package/components/u--input/u--input.vue +115 -0
- package/components/u--text/u--text.vue +72 -0
- package/components/u--textarea/u--textarea.vue +85 -0
- package/components/u-action-sheet/props.js +54 -0
- package/components/u-action-sheet/u-action-sheet.vue +278 -0
- package/components/u-album/props.js +59 -0
- package/components/u-album/u-album.vue +259 -0
- package/components/u-alert/props.js +44 -0
- package/components/u-alert/u-alert.vue +243 -0
- package/components/u-avatar/props.js +78 -0
- package/components/u-avatar/u-avatar.vue +173 -0
- package/components/u-avatar-group/props.js +52 -0
- package/components/u-avatar-group/u-avatar-group.vue +103 -0
- package/components/u-back-top/props.js +54 -0
- package/components/u-back-top/u-back-top.vue +129 -0
- package/components/u-badge/props.js +72 -0
- package/components/u-badge/u-badge.vue +171 -0
- package/components/u-button/nvue.scss +46 -0
- package/components/u-button/props.js +161 -0
- package/components/u-button/u-button.vue +495 -0
- package/components/u-button/vue.scss +80 -0
- package/components/u-calendar/header.vue +99 -0
- package/components/u-calendar/month.vue +579 -0
- package/components/u-calendar/props.js +144 -0
- package/components/u-calendar/u-calendar.vue +384 -0
- package/components/u-calendar/util.js +85 -0
- package/components/u-car-keyboard/props.js +14 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +311 -0
- package/components/u-cell/props.js +110 -0
- package/components/u-cell/u-cell.vue +229 -0
- package/components/u-cell-group/props.js +14 -0
- package/components/u-cell-group/u-cell-group.vue +61 -0
- package/components/u-checkbox/props.js +69 -0
- package/components/u-checkbox/u-checkbox.vue +344 -0
- package/components/u-checkbox-group/props.js +82 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +103 -0
- package/components/u-circle-progress/props.js +8 -0
- package/components/u-circle-progress/u-circle-progress.vue +198 -0
- package/components/u-code/props.js +34 -0
- package/components/u-code/u-code.vue +129 -0
- package/components/u-code-input/props.js +79 -0
- package/components/u-code-input/u-code-input.vue +252 -0
- package/components/u-col/props.js +29 -0
- package/components/u-col/u-col.vue +162 -0
- package/components/u-collapse/props.js +19 -0
- package/components/u-collapse/u-collapse.vue +90 -0
- package/components/u-collapse-item/props.js +59 -0
- package/components/u-collapse-item/u-collapse-item.vue +225 -0
- package/components/u-column-notice/props.js +55 -0
- package/components/u-column-notice/u-column-notice.vue +160 -0
- package/components/u-count-down/props.js +24 -0
- package/components/u-count-down/u-count-down.vue +163 -0
- package/components/u-count-down/utils.js +62 -0
- package/components/u-count-to/props.js +59 -0
- package/components/u-count-to/u-count-to.vue +184 -0
- package/components/u-datetime-picker/props.js +120 -0
- package/components/u-datetime-picker/u-datetime-picker.vue +361 -0
- package/components/u-divider/props.js +44 -0
- package/components/u-divider/u-divider.vue +116 -0
- package/components/u-dropdown/props.js +65 -0
- package/components/u-dropdown/u-dropdown.vue +127 -0
- package/components/u-dropdown-item/props.js +36 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +127 -0
- package/components/u-empty/props.js +59 -0
- package/components/u-empty/u-empty.vue +128 -0
- package/components/u-form/props.js +45 -0
- package/components/u-form/u-form.vue +214 -0
- package/components/u-form-item/props.js +48 -0
- package/components/u-form-item/u-form-item.vue +235 -0
- package/components/u-gap/props.js +24 -0
- package/components/u-gap/u-gap.vue +38 -0
- package/components/u-grid/props.js +19 -0
- package/components/u-grid/u-grid.vue +97 -0
- package/components/u-grid-item/props.js +14 -0
- package/components/u-grid-item/u-grid-item.vue +209 -0
- package/components/u-icon/icons.js +214 -0
- package/components/u-icon/props.js +89 -0
- package/components/u-icon/u-icon.vue +237 -0
- package/components/u-image/props.js +84 -0
- package/components/u-image/u-image.vue +232 -0
- package/components/u-index-anchor/props.js +29 -0
- package/components/u-index-anchor/u-index-anchor.vue +91 -0
- package/components/u-index-item/props.js +5 -0
- package/components/u-index-item/u-index-item.vue +87 -0
- package/components/u-index-list/props.js +29 -0
- package/components/u-index-list/u-index-list.vue +440 -0
- package/components/u-input/props.js +187 -0
- package/components/u-input/u-input.vue +369 -0
- package/components/u-keyboard/props.js +84 -0
- package/components/u-keyboard/u-keyboard.vue +164 -0
- package/components/u-line/props.js +33 -0
- package/components/u-line/u-line.vue +62 -0
- package/components/u-line-progress/props.js +28 -0
- package/components/u-line-progress/u-line-progress.vue +144 -0
- package/components/u-link/props.js +39 -0
- package/components/u-link/u-link.vue +83 -0
- package/components/u-list/props.js +76 -0
- package/components/u-list/u-list.vue +157 -0
- package/components/u-list-item/props.js +9 -0
- package/components/u-list-item/u-list-item.vue +116 -0
- package/components/u-loading-icon/props.js +59 -0
- package/components/u-loading-icon/u-loading-icon.vue +343 -0
- package/components/u-loading-page/props.js +49 -0
- package/components/u-loading-page/u-loading-page.vue +115 -0
- package/components/u-loadmore/props.js +94 -0
- package/components/u-loadmore/u-loadmore.vue +150 -0
- package/components/u-modal/props.js +89 -0
- package/components/u-modal/u-modal.vue +228 -0
- package/components/u-navbar/props.js +84 -0
- package/components/u-navbar/u-navbar.vue +186 -0
- package/components/u-no-network/props.js +19 -0
- package/components/u-no-network/u-no-network.vue +220 -0
- package/components/u-notice-bar/props.js +70 -0
- package/components/u-notice-bar/u-notice-bar.vue +101 -0
- package/components/u-notify/props.js +49 -0
- package/components/u-notify/u-notify.vue +211 -0
- package/components/u-number-box/props.js +109 -0
- package/components/u-number-box/u-number-box.vue +416 -0
- package/components/u-number-keyboard/props.js +19 -0
- package/components/u-number-keyboard/u-number-keyboard.vue +196 -0
- package/components/u-overlay/props.js +24 -0
- package/components/u-overlay/u-overlay.vue +68 -0
- package/components/u-parse/node/node.vue +499 -0
- package/components/u-parse/parser.js +1075 -0
- package/components/u-parse/props.js +45 -0
- package/components/u-parse/u-parse.vue +366 -0
- package/components/u-picker/props.js +79 -0
- package/components/u-picker/u-picker.vue +286 -0
- package/components/u-picker-column/props.js +5 -0
- package/components/u-picker-column/u-picker-column.vue +27 -0
- package/components/u-popup/props.js +79 -0
- package/components/u-popup/u-popup.vue +304 -0
- package/components/u-radio/props.js +64 -0
- package/components/u-radio/u-radio.vue +339 -0
- package/components/u-radio-group/props.js +85 -0
- package/components/u-radio-group/u-radio-group.vue +108 -0
- package/components/u-rate/props.js +69 -0
- package/components/u-rate/u-rate.vue +306 -0
- package/components/u-read-more/props.js +61 -0
- package/components/u-read-more/u-read-more.vue +157 -0
- package/components/u-row/props.js +19 -0
- package/components/u-row/u-row.vue +93 -0
- package/components/u-row-notice/props.js +39 -0
- package/components/u-row-notice/u-row-notice.vue +330 -0
- package/components/u-safe-bottom/props.js +5 -0
- package/components/u-safe-bottom/u-safe-bottom.vue +56 -0
- package/components/u-scroll-list/nvue.js +28 -0
- package/components/u-scroll-list/other.js +0 -0
- package/components/u-scroll-list/props.js +34 -0
- package/components/u-scroll-list/scrollWxs.wxs +50 -0
- package/components/u-scroll-list/u-scroll-list.vue +224 -0
- package/components/u-search/props.js +118 -0
- package/components/u-search/u-search.vue +303 -0
- package/components/u-skeleton/props.js +59 -0
- package/components/u-skeleton/u-skeleton.vue +244 -0
- package/components/u-slider/mpother.js +113 -0
- package/components/u-slider/mpwxs.js +42 -0
- package/components/u-slider/mpwxs.wxs +121 -0
- package/components/u-slider/nvue - /345/211/257/346/234/254.js" +180 -0
- package/components/u-slider/nvue.js +193 -0
- package/components/u-slider/props.js +54 -0
- package/components/u-slider/u-slider.vue +55 -0
- package/components/u-status-bar/props.js +8 -0
- package/components/u-status-bar/u-status-bar.vue +46 -0
- package/components/u-steps/props.js +39 -0
- package/components/u-steps/u-steps.vue +80 -0
- package/components/u-steps-item/props.js +24 -0
- package/components/u-steps-item/u-steps-item.vue +316 -0
- package/components/u-sticky/props.js +40 -0
- package/components/u-sticky/u-sticky.vue +212 -0
- package/components/u-subsection/props.js +49 -0
- package/components/u-subsection/u-subsection.vue +299 -0
- package/components/u-swipe-action/props.js +9 -0
- package/components/u-swipe-action/u-swipe-action.vue +67 -0
- package/components/u-swipe-action-item/index - backup.wxs +256 -0
- package/components/u-swipe-action-item/index.wxs +225 -0
- package/components/u-swipe-action-item/nvue - backup.js +270 -0
- package/components/u-swipe-action-item/nvue.js +174 -0
- package/components/u-swipe-action-item/props.js +41 -0
- package/components/u-swipe-action-item/u-swipe-action-item.vue +190 -0
- package/components/u-swipe-action-item/wxs.js +15 -0
- package/components/u-swiper/props.js +125 -0
- package/components/u-swiper/u-swiper.vue +255 -0
- package/components/u-swiper-indicator/props.js +29 -0
- package/components/u-swiper-indicator/u-swiper-indicator.vue +110 -0
- package/components/u-switch/props.js +54 -0
- package/components/u-switch/u-switch.vue +177 -0
- package/components/u-tabbar/props.js +44 -0
- package/components/u-tabbar/u-tabbar.vue +141 -0
- package/components/u-tabbar-item/props.js +35 -0
- package/components/u-tabbar-item/u-tabbar-item.vue +142 -0
- package/components/u-table/props.js +5 -0
- package/components/u-table/u-table.vue +29 -0
- package/components/u-tabs/props.js +64 -0
- package/components/u-tabs/u-tabs.vue +363 -0
- package/components/u-tabs-item/props.js +5 -0
- package/components/u-tabs-item/u-tabs-item.vue +29 -0
- package/components/u-tag/props.js +84 -0
- package/components/u-tag/u-tag.vue +358 -0
- package/components/u-td/props.js +5 -0
- package/components/u-td/u-td.vue +31 -0
- package/components/u-text/props.js +110 -0
- package/components/u-text/u-text.vue +223 -0
- package/components/u-text/value.js +85 -0
- package/components/u-textarea/props.js +119 -0
- package/components/u-textarea/u-textarea.vue +239 -0
- package/components/u-toast/u-toast.vue +291 -0
- package/components/u-toolbar/props.js +34 -0
- package/components/u-toolbar/u-toolbar.vue +102 -0
- package/components/u-tooltip/clipboard.min.js +58 -0
- package/components/u-tooltip/props.js +59 -0
- package/components/u-tooltip/u-tooltip.vue +366 -0
- package/components/u-tr/props.js +5 -0
- package/components/u-tr/u-tr.vue +31 -0
- package/components/u-transition/nvue.ani-map.js +68 -0
- package/components/u-transition/props.js +24 -0
- package/components/u-transition/transition.js +157 -0
- package/components/u-transition/u-transition.vue +92 -0
- package/components/u-transition/vue.ani-style.scss +113 -0
- package/components/u-upload/mixin.js +21 -0
- package/components/u-upload/props.js +124 -0
- package/components/u-upload/u-upload.vue +566 -0
- package/components/u-upload/utils.js +151 -0
- package/components/uview-ui/uview-ui.vue +15 -0
- package/index.js +79 -0
- package/index.scss +23 -0
- package/libs/config/color.js +17 -0
- package/libs/config/config.js +34 -0
- package/libs/config/props/actionSheet.js +25 -0
- package/libs/config/props/album.js +25 -0
- package/libs/config/props/alert.js +22 -0
- package/libs/config/props/avatar.js +28 -0
- package/libs/config/props/avatarGroup.js +23 -0
- package/libs/config/props/backtop.js +27 -0
- package/libs/config/props/badge.js +27 -0
- package/libs/config/props/button.js +42 -0
- package/libs/config/props/calendar.js +42 -0
- package/libs/config/props/carKeyboard.js +15 -0
- package/libs/config/props/cell.js +35 -0
- package/libs/config/props/cellGroup.js +17 -0
- package/libs/config/props/checkbox.js +27 -0
- package/libs/config/props/checkboxGroup.js +29 -0
- package/libs/config/props/circleProgress.js +15 -0
- package/libs/config/props/code.js +21 -0
- package/libs/config/props/codeInput.js +29 -0
- package/libs/config/props/col.js +19 -0
- package/libs/config/props/collapse.js +17 -0
- package/libs/config/props/collapseItem.js +25 -0
- package/libs/config/props/columnNotice.js +24 -0
- package/libs/config/props/countDown.js +18 -0
- package/libs/config/props/countTo.js +25 -0
- package/libs/config/props/datetimePicker.js +37 -0
- package/libs/config/props/divider.js +23 -0
- package/libs/config/props/empty.js +26 -0
- package/libs/config/props/form.js +22 -0
- package/libs/config/props/formItem.js +23 -0
- package/libs/config/props/gap.js +19 -0
- package/libs/config/props/grid.js +17 -0
- package/libs/config/props/gridItem.js +16 -0
- package/libs/config/props/icon.js +36 -0
- package/libs/config/props/image.js +30 -0
- package/libs/config/props/indexAnchor.js +19 -0
- package/libs/config/props/indexList.js +19 -0
- package/libs/config/props/input.js +48 -0
- package/libs/config/props/keyboard.js +30 -0
- package/libs/config/props/line.js +20 -0
- package/libs/config/props/lineProgress.js +19 -0
- package/libs/config/props/link.js +26 -0
- package/libs/config/props/list.js +28 -0
- package/libs/config/props/listItem.js +15 -0
- package/libs/config/props/loadingIcon.js +30 -0
- package/libs/config/props/loadingPage.js +23 -0
- package/libs/config/props/loadmore.js +32 -0
- package/libs/config/props/modal.js +31 -0
- package/libs/config/props/navbar.js +32 -0
- package/libs/config/props/noNetwork.js +18 -0
- package/libs/config/props/noticeBar.js +27 -0
- package/libs/config/props/notify.js +22 -0
- package/libs/config/props/numberBox.js +35 -0
- package/libs/config/props/numberKeyboard.js +17 -0
- package/libs/config/props/overlay.js +18 -0
- package/libs/config/props/parse.js +22 -0
- package/libs/config/props/picker.js +29 -0
- package/libs/config/props/popup.js +29 -0
- package/libs/config/props/radio.js +27 -0
- package/libs/config/props/radioGroup.js +30 -0
- package/libs/config/props/rate.js +26 -0
- package/libs/config/props/readMore.js +22 -0
- package/libs/config/props/row.js +17 -0
- package/libs/config/props/rowNotice.js +21 -0
- package/libs/config/props/scrollList.js +20 -0
- package/libs/config/props/search.js +37 -0
- package/libs/config/props/section.js +24 -0
- package/libs/config/props/skeleton.js +25 -0
- package/libs/config/props/slider.js +25 -0
- package/libs/config/props/statusBar.js +15 -0
- package/libs/config/props/steps.js +21 -0
- package/libs/config/props/stepsItem.js +18 -0
- package/libs/config/props/sticky.js +20 -0
- package/libs/config/props/subsection.js +23 -0
- package/libs/config/props/swipeAction.js +15 -0
- package/libs/config/props/swipeActionItem.js +21 -0
- package/libs/config/props/swiper.js +39 -0
- package/libs/config/props/swipterIndicator.js +19 -0
- package/libs/config/props/switch.js +24 -0
- package/libs/config/props/tabbar.js +22 -0
- package/libs/config/props/tabbarItem.js +20 -0
- package/libs/config/props/tabs.js +32 -0
- package/libs/config/props/tag.js +29 -0
- package/libs/config/props/text.js +38 -0
- package/libs/config/props/textarea.js +36 -0
- package/libs/config/props/toast.js +30 -0
- package/libs/config/props/toolbar.js +21 -0
- package/libs/config/props/tooltip.js +25 -0
- package/libs/config/props/transition.js +18 -0
- package/libs/config/props/upload.js +36 -0
- package/libs/config/props.js +190 -0
- package/libs/config/zIndex.js +20 -0
- package/libs/css/color.scss +155 -0
- package/libs/css/common.scss +97 -0
- package/libs/css/components.scss +15 -0
- package/libs/css/flex.scss +257 -0
- package/libs/css/h5.scss +0 -0
- package/libs/css/mixin.scss +8 -0
- package/libs/css/mp.scss +0 -0
- package/libs/css/nvue.scss +0 -0
- package/libs/css/vue.scss +27 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +731 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +288 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +97 -0
- package/libs/luch-request/core/InterceptorManager.js +50 -0
- package/libs/luch-request/core/Request.js +198 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +29 -0
- package/libs/luch-request/core/dispatchRequest.js +3 -0
- package/libs/luch-request/core/mergeConfig.js +103 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +69 -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 +116 -0
- package/libs/luch-request/index.js +3 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +131 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +160 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +25 -0
- package/libs/mixin/style.js +228 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/async-validator.js +1343 -0
- package/libs/util/calendar.js +546 -0
- package/libs/util/dayjs.js +308 -0
- package/libs/util/emitter.js +51 -0
- package/libs/util/route.js +124 -0
- package/package.json +83 -0
- package/theme.scss +44 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否打开组件
|
|
4
|
+
show: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: uni.$u.props.datetimePicker.show
|
|
7
|
+
},
|
|
8
|
+
// 是否展示顶部的操作栏
|
|
9
|
+
showToolbar: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: uni.$u.props.datetimePicker.showToolbar
|
|
12
|
+
},
|
|
13
|
+
// 绑定值
|
|
14
|
+
value: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: uni.$u.props.datetimePicker.value
|
|
17
|
+
},
|
|
18
|
+
// 顶部标题
|
|
19
|
+
title: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: uni.$u.props.datetimePicker.title
|
|
22
|
+
},
|
|
23
|
+
// 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择
|
|
24
|
+
mode: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.datetimePicker.mode
|
|
27
|
+
},
|
|
28
|
+
// 可选的最大时间
|
|
29
|
+
maxDate: {
|
|
30
|
+
type: Number,
|
|
31
|
+
// 最大默认值为后10年
|
|
32
|
+
default: uni.$u.props.datetimePicker.maxDate
|
|
33
|
+
},
|
|
34
|
+
// 可选的最小时间
|
|
35
|
+
minDate: {
|
|
36
|
+
type: Number,
|
|
37
|
+
// 最小默认值为前10年
|
|
38
|
+
default: uni.$u.props.datetimePicker.minDate
|
|
39
|
+
},
|
|
40
|
+
// 可选的最小小时,仅mode=time有效
|
|
41
|
+
minHour: {
|
|
42
|
+
type: Number,
|
|
43
|
+
default: uni.$u.props.datetimePicker.minHour
|
|
44
|
+
},
|
|
45
|
+
// 可选的最大小时,仅mode=time有效
|
|
46
|
+
maxHour: {
|
|
47
|
+
type: Number,
|
|
48
|
+
default: uni.$u.props.datetimePicker.maxHour
|
|
49
|
+
},
|
|
50
|
+
// 可选的最小分钟,仅mode=time有效
|
|
51
|
+
minMinute: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: uni.$u.props.datetimePicker.minMinute
|
|
54
|
+
},
|
|
55
|
+
// 可选的最大分钟,仅mode=time有效
|
|
56
|
+
maxMinute: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: uni.$u.props.datetimePicker.maxMinute
|
|
59
|
+
},
|
|
60
|
+
// 选项过滤函数
|
|
61
|
+
filter: {
|
|
62
|
+
type: [Function, null],
|
|
63
|
+
default: uni.$u.props.datetimePicker.filter
|
|
64
|
+
},
|
|
65
|
+
// 选项格式化函数
|
|
66
|
+
formatter: {
|
|
67
|
+
type: [Function, null],
|
|
68
|
+
default: uni.$u.props.datetimePicker.formatter
|
|
69
|
+
},
|
|
70
|
+
// 是否显示加载中状态
|
|
71
|
+
loading: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: uni.$u.props.datetimePicker.loading
|
|
74
|
+
},
|
|
75
|
+
// 各列中,单个选项的高度
|
|
76
|
+
itemHeight: {
|
|
77
|
+
type: [String, Number],
|
|
78
|
+
default: uni.$u.props.datetimePicker.itemHeight
|
|
79
|
+
},
|
|
80
|
+
// 取消按钮的文字
|
|
81
|
+
cancelText: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: uni.$u.props.datetimePicker.cancelText
|
|
84
|
+
},
|
|
85
|
+
// 确认按钮的文字
|
|
86
|
+
confirmText: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: uni.$u.props.datetimePicker.confirmText
|
|
89
|
+
},
|
|
90
|
+
// 取消按钮的颜色
|
|
91
|
+
cancelColor: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: uni.$u.props.datetimePicker.cancelColor
|
|
94
|
+
},
|
|
95
|
+
// 确认按钮的颜色
|
|
96
|
+
confirmColor: {
|
|
97
|
+
type: String,
|
|
98
|
+
default: uni.$u.props.datetimePicker.confirmColor
|
|
99
|
+
},
|
|
100
|
+
// 每列中可见选项的数量
|
|
101
|
+
visibleItemCount: {
|
|
102
|
+
type: [String, Number],
|
|
103
|
+
default: uni.$u.props.datetimePicker.visibleItemCount
|
|
104
|
+
},
|
|
105
|
+
// 是否允许点击遮罩关闭选择器
|
|
106
|
+
closeOnClickOverlay: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: uni.$u.props.datetimePicker.closeOnClickOverlay
|
|
109
|
+
},
|
|
110
|
+
// 各列的默认索引
|
|
111
|
+
defaultIndex: {
|
|
112
|
+
type: Array,
|
|
113
|
+
default: uni.$u.props.datetimePicker.defaultIndex
|
|
114
|
+
},
|
|
115
|
+
immediateChange: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
default: uni.$u.props.datetimePicker.immediateChange
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<u-picker
|
|
3
|
+
ref="picker"
|
|
4
|
+
:show="show"
|
|
5
|
+
:closeOnClickOverlay="closeOnClickOverlay"
|
|
6
|
+
:columns="columns"
|
|
7
|
+
:title="title"
|
|
8
|
+
:itemHeight="itemHeight"
|
|
9
|
+
:showToolbar="showToolbar"
|
|
10
|
+
:visibleItemCount="visibleItemCount"
|
|
11
|
+
:defaultIndex="innerDefaultIndex"
|
|
12
|
+
:cancelText="cancelText"
|
|
13
|
+
:confirmText="confirmText"
|
|
14
|
+
:cancelColor="cancelColor"
|
|
15
|
+
:confirmColor="confirmColor"
|
|
16
|
+
:immediateChange="immediateChange"
|
|
17
|
+
@close="close"
|
|
18
|
+
@cancel="cancel"
|
|
19
|
+
@confirm="confirm"
|
|
20
|
+
@change="change"
|
|
21
|
+
>
|
|
22
|
+
</u-picker>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
function times(n, iteratee) {
|
|
27
|
+
let index = -1
|
|
28
|
+
const result = Array(n < 0 ? 0 : n)
|
|
29
|
+
while (++index < n) {
|
|
30
|
+
result[index] = iteratee(index)
|
|
31
|
+
}
|
|
32
|
+
return result
|
|
33
|
+
}
|
|
34
|
+
import props from './props.js';
|
|
35
|
+
import dayjs from '../../libs/util/dayjs.js';
|
|
36
|
+
/**
|
|
37
|
+
* DatetimePicker 时间日期选择器
|
|
38
|
+
* @description 此选择器用于时间日期
|
|
39
|
+
* @tutorial https://www.uviewui.com/components/datetimePicker.html
|
|
40
|
+
* @property {Boolean} show 用于控制选择器的弹出与收起 ( 默认 false )
|
|
41
|
+
* @property {Boolean} showToolbar 是否显示顶部的操作栏 ( 默认 true )
|
|
42
|
+
* @property {String | Number} value 绑定值
|
|
43
|
+
* @property {String} title 顶部标题
|
|
44
|
+
* @property {String} mode 展示格式 mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择 ( 默认 ‘datetime )
|
|
45
|
+
* @property {Number} maxDate 可选的最大时间 默认值为后10年
|
|
46
|
+
* @property {Number} minDate 可选的最小时间 默认值为前10年
|
|
47
|
+
* @property {Number} minHour 可选的最小小时,仅mode=time有效 ( 默认 0 )
|
|
48
|
+
* @property {Number} maxHour 可选的最大小时,仅mode=time有效 ( 默认 23 )
|
|
49
|
+
* @property {Number} minMinute 可选的最小分钟,仅mode=time有效 ( 默认 0 )
|
|
50
|
+
* @property {Number} maxMinute 可选的最大分钟,仅mode=time有效 ( 默认 59 )
|
|
51
|
+
* @property {Function} filter 选项过滤函数
|
|
52
|
+
* @property {Function} formatter 选项格式化函数
|
|
53
|
+
* @property {Boolean} loading 是否显示加载中状态 ( 默认 false )
|
|
54
|
+
* @property {String | Number} itemHeight 各列中,单个选项的高度 ( 默认 44 )
|
|
55
|
+
* @property {String} cancelText 取消按钮的文字 ( 默认 '取消' )
|
|
56
|
+
* @property {String} confirmText 确认按钮的文字 ( 默认 '确认' )
|
|
57
|
+
* @property {String} cancelColor 取消按钮的颜色 ( 默认 '#909193' )
|
|
58
|
+
* @property {String} confirmColor 确认按钮的颜色 ( 默认 '#3c9cff' )
|
|
59
|
+
* @property {String | Number} visibleItemCount 每列中可见选项的数量 ( 默认 5 )
|
|
60
|
+
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭选择器 ( 默认 false )
|
|
61
|
+
* @property {Array} defaultIndex 各列的默认索引
|
|
62
|
+
* @event {Function} close 关闭选择器时触发
|
|
63
|
+
* @event {Function} confirm 点击确定按钮,返回当前选择的值
|
|
64
|
+
* @event {Function} change 当选择值变化时触发
|
|
65
|
+
* @event {Function} cancel 点击取消按钮
|
|
66
|
+
* @example <u-datetime-picker :show="show" :value="value1" mode="datetime" ></u-datetime-picker>
|
|
67
|
+
*/
|
|
68
|
+
export default {
|
|
69
|
+
name: 'datetime-picker',
|
|
70
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
columns: [],
|
|
74
|
+
innerDefaultIndex: [],
|
|
75
|
+
innerFormatter: (type, value) => value
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
watch: {
|
|
79
|
+
show(newValue, oldValue) {
|
|
80
|
+
if (newValue) {
|
|
81
|
+
this.updateColumnValue(this.innerValue)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
propsChange() {
|
|
85
|
+
this.init()
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
computed: {
|
|
89
|
+
// 如果以下这些变量发生了变化,意味着需要重新初始化各列的值
|
|
90
|
+
propsChange() {
|
|
91
|
+
return [this.mode, this.maxDate, this.minDate, this.minHour, this.maxHour, this.minMinute, this.maxMinute, this.filter, this.value, ]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
mounted() {
|
|
95
|
+
this.init()
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
init() {
|
|
99
|
+
this.innerValue = this.correctValue(this.value)
|
|
100
|
+
this.updateColumnValue(this.innerValue)
|
|
101
|
+
},
|
|
102
|
+
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
|
|
103
|
+
setFormatter(e) {
|
|
104
|
+
this.innerFormatter = e
|
|
105
|
+
},
|
|
106
|
+
// 关闭选择器
|
|
107
|
+
close() {
|
|
108
|
+
if (this.closeOnClickOverlay) {
|
|
109
|
+
this.$emit('close')
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
// 点击工具栏的取消按钮
|
|
113
|
+
cancel() {
|
|
114
|
+
this.$emit('cancel')
|
|
115
|
+
},
|
|
116
|
+
// 点击工具栏的确定按钮
|
|
117
|
+
confirm() {
|
|
118
|
+
this.$emit('confirm', {
|
|
119
|
+
value: this.innerValue,
|
|
120
|
+
mode: this.mode
|
|
121
|
+
})
|
|
122
|
+
this.$emit('input', this.innerValue)
|
|
123
|
+
},
|
|
124
|
+
//用正则截取输出值,当出现多组数字时,抛出错误
|
|
125
|
+
intercept(e,type){
|
|
126
|
+
let judge = e.match(/\d+/g)
|
|
127
|
+
//判断是否掺杂数字
|
|
128
|
+
if(judge.length>1){
|
|
129
|
+
uni.$u.error("请勿在过滤或格式化函数时添加数字")
|
|
130
|
+
return 0
|
|
131
|
+
}else if(type&&judge[0].length==4){//判断是否是年份
|
|
132
|
+
return judge[0]
|
|
133
|
+
}else if(judge[0].length>2){
|
|
134
|
+
uni.$u.error("请勿在过滤或格式化函数时添加数字")
|
|
135
|
+
return 0
|
|
136
|
+
}else{
|
|
137
|
+
return judge[0]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
// 列发生变化时触发
|
|
141
|
+
change(e) {
|
|
142
|
+
const { indexs, values } = e
|
|
143
|
+
let selectValue = ''
|
|
144
|
+
if(this.mode === 'time') {
|
|
145
|
+
// 根据value各列索引,从各列数组中,取出当前时间的选中值
|
|
146
|
+
selectValue = `${this.intercept(values[0][indexs[0]])}:${this.intercept(values[1][indexs[1]])}`
|
|
147
|
+
} else {
|
|
148
|
+
// 将选择的值转为数值,比如'03'转为数值的3,'2019'转为数值的2019
|
|
149
|
+
const year = parseInt(this.intercept(values[0][indexs[0]],'year'))
|
|
150
|
+
const month = parseInt(this.intercept(values[1][indexs[1]]))
|
|
151
|
+
let date = parseInt(values[2] ? this.intercept(values[2][indexs[2]]) : 1)
|
|
152
|
+
let hour = 0, minute = 0
|
|
153
|
+
// 此月份的最大天数
|
|
154
|
+
const maxDate = dayjs(`${year}-${month}`).daysInMonth()
|
|
155
|
+
// year-month模式下,date不会出现在列中,设置为1,为了符合后边需要减1的需求
|
|
156
|
+
if (this.mode === 'year-month') {
|
|
157
|
+
date = 1
|
|
158
|
+
}
|
|
159
|
+
// 不允许超过maxDate值
|
|
160
|
+
date = Math.min(maxDate, date)
|
|
161
|
+
if (this.mode === 'datetime') {
|
|
162
|
+
hour = parseInt(this.intercept(values[3][indexs[3]]))
|
|
163
|
+
minute = parseInt(this.intercept(values[4][indexs[4]]))
|
|
164
|
+
}
|
|
165
|
+
// 转为时间模式
|
|
166
|
+
selectValue = Number(new Date(year, month - 1, date, hour, minute))
|
|
167
|
+
}
|
|
168
|
+
// 取出准确的合法值,防止超越边界的情况
|
|
169
|
+
selectValue = this.correctValue(selectValue)
|
|
170
|
+
this.innerValue = selectValue
|
|
171
|
+
this.updateColumnValue(selectValue)
|
|
172
|
+
// 发出change时间,value为当前选中的时间戳
|
|
173
|
+
this.$emit('change', {
|
|
174
|
+
value: selectValue,
|
|
175
|
+
// #ifndef MP-WEIXIN || MP-TOUTIAO
|
|
176
|
+
// 微信小程序不能传递this实例,会因为循环引用而报错
|
|
177
|
+
picker: this.$refs.picker,
|
|
178
|
+
// #endif
|
|
179
|
+
mode: this.mode
|
|
180
|
+
})
|
|
181
|
+
},
|
|
182
|
+
// 更新各列的值,进行补0、格式化等操作
|
|
183
|
+
updateColumnValue(value) {
|
|
184
|
+
this.innerValue = value
|
|
185
|
+
this.updateColumns()
|
|
186
|
+
this.updateIndexs(value)
|
|
187
|
+
},
|
|
188
|
+
// 更新索引
|
|
189
|
+
updateIndexs(value) {
|
|
190
|
+
let values = []
|
|
191
|
+
const formatter = this.formatter || this.innerFormatter
|
|
192
|
+
const padZero = uni.$u.padZero
|
|
193
|
+
if (this.mode === 'time') {
|
|
194
|
+
// 将time模式的时间用:分隔成数组
|
|
195
|
+
const timeArr = value.split(':')
|
|
196
|
+
// 使用formatter格式化方法进行管道处理
|
|
197
|
+
values = [formatter('hour', timeArr[0]), formatter('minute', timeArr[1])]
|
|
198
|
+
} else {
|
|
199
|
+
const date = new Date(value)
|
|
200
|
+
values = [
|
|
201
|
+
formatter('year', `${dayjs(value).year()}`),
|
|
202
|
+
// 月份补0
|
|
203
|
+
formatter('month', padZero(dayjs(value).month() + 1))
|
|
204
|
+
]
|
|
205
|
+
if (this.mode === 'date') {
|
|
206
|
+
// date模式,需要添加天列
|
|
207
|
+
values.push(formatter('day', padZero(dayjs(value).date())))
|
|
208
|
+
}
|
|
209
|
+
if (this.mode === 'datetime') {
|
|
210
|
+
// 数组的push方法,可以写入多个参数
|
|
211
|
+
values.push(formatter('day', padZero(dayjs(value).date())), formatter('hour', padZero(dayjs(value).hour())), formatter('minute', padZero(dayjs(value).minute())))
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 根据当前各列的所有值,从各列默认值中找到默认值在各列中的索引
|
|
216
|
+
const indexs = this.columns.map((column, index) => {
|
|
217
|
+
// 通过取大值,可以保证不会出现找不到索引的-1情况
|
|
218
|
+
return Math.max(0, column.findIndex(item => item === values[index]))
|
|
219
|
+
})
|
|
220
|
+
this.innerDefaultIndex = indexs
|
|
221
|
+
},
|
|
222
|
+
// 更新各列的值
|
|
223
|
+
updateColumns() {
|
|
224
|
+
const formatter = this.formatter || this.innerFormatter
|
|
225
|
+
// 获取各列的值,并且map后,对各列的具体值进行补0操作
|
|
226
|
+
const results = this.getOriginColumns().map((column) => column.values.map((value) => formatter(column.type, value)))
|
|
227
|
+
this.columns = results
|
|
228
|
+
},
|
|
229
|
+
getOriginColumns() {
|
|
230
|
+
// 生成各列的值
|
|
231
|
+
const results = this.getRanges().map(({ type, range }) => {
|
|
232
|
+
let values = times(range[1] - range[0] + 1, (index) => {
|
|
233
|
+
let value = range[0] + index
|
|
234
|
+
value = type === 'year' ? `${value}` : uni.$u.padZero(value)
|
|
235
|
+
return value
|
|
236
|
+
})
|
|
237
|
+
// 进行过滤
|
|
238
|
+
if (this.filter) {
|
|
239
|
+
values = this.filter(type, values)
|
|
240
|
+
}
|
|
241
|
+
return { type, values }
|
|
242
|
+
})
|
|
243
|
+
return results
|
|
244
|
+
},
|
|
245
|
+
// 通过最大值和最小值生成数组
|
|
246
|
+
generateArray(start, end) {
|
|
247
|
+
return Array.from(new Array(end + 1).keys()).slice(start)
|
|
248
|
+
},
|
|
249
|
+
// 得出合法的时间
|
|
250
|
+
correctValue(value) {
|
|
251
|
+
const isDateMode = this.mode !== 'time'
|
|
252
|
+
if (isDateMode && !uni.$u.test.date(value)) {
|
|
253
|
+
// 如果是日期类型,但是又没有设置合法的当前时间的话,使用最小时间为当前时间
|
|
254
|
+
value = this.minDate
|
|
255
|
+
} else if (!isDateMode && !value) {
|
|
256
|
+
// 如果是时间类型,而又没有默认值的话,就用最小时间
|
|
257
|
+
value = `${uni.$u.padZero(this.minHour)}:${uni.$u.padZero(this.minMinute)}`
|
|
258
|
+
}
|
|
259
|
+
// 时间类型
|
|
260
|
+
if (!isDateMode) {
|
|
261
|
+
if (String(value).indexOf(':') === -1) return uni.$u.error('时间错误,请传递如12:24的格式')
|
|
262
|
+
let [hour, minute] = value.split(':')
|
|
263
|
+
// 对时间补零,同时控制在最小值和最大值之间
|
|
264
|
+
hour = uni.$u.padZero(uni.$u.range(this.minHour, this.maxHour, Number(hour)))
|
|
265
|
+
minute = uni.$u.padZero(uni.$u.range(this.minMinute, this.maxMinute, Number(minute)))
|
|
266
|
+
return `${ hour }:${ minute }`
|
|
267
|
+
} else {
|
|
268
|
+
// 如果是日期格式,控制在最小日期和最大日期之间
|
|
269
|
+
value = dayjs(value).isBefore(dayjs(this.minDate)) ? this.minDate : value
|
|
270
|
+
value = dayjs(value).isAfter(dayjs(this.maxDate)) ? this.maxDate : value
|
|
271
|
+
return value
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
// 获取每列的最大和最小值
|
|
275
|
+
getRanges() {
|
|
276
|
+
if (this.mode === 'time') {
|
|
277
|
+
return [
|
|
278
|
+
{
|
|
279
|
+
type: 'hour',
|
|
280
|
+
range: [this.minHour, this.maxHour],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
type: 'minute',
|
|
284
|
+
range: [this.minMinute, this.maxMinute],
|
|
285
|
+
},
|
|
286
|
+
];
|
|
287
|
+
}
|
|
288
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, } = this.getBoundary('max', this.innerValue);
|
|
289
|
+
const { minYear, minDate, minMonth, minHour, minMinute, } = this.getBoundary('min', this.innerValue);
|
|
290
|
+
const result = [
|
|
291
|
+
{
|
|
292
|
+
type: 'year',
|
|
293
|
+
range: [minYear, maxYear],
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
type: 'month',
|
|
297
|
+
range: [minMonth, maxMonth],
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
type: 'day',
|
|
301
|
+
range: [minDate, maxDate],
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'hour',
|
|
305
|
+
range: [minHour, maxHour],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
type: 'minute',
|
|
309
|
+
range: [minMinute, maxMinute],
|
|
310
|
+
},
|
|
311
|
+
];
|
|
312
|
+
if (this.mode === 'date')
|
|
313
|
+
result.splice(3, 2);
|
|
314
|
+
if (this.mode === 'year-month')
|
|
315
|
+
result.splice(2, 3);
|
|
316
|
+
return result;
|
|
317
|
+
},
|
|
318
|
+
// 根据minDate、maxDate、minHour、maxHour等边界值,判断各列的开始和结束边界值
|
|
319
|
+
getBoundary(type, innerValue) {
|
|
320
|
+
const value = new Date(innerValue)
|
|
321
|
+
const boundary = new Date(this[`${type}Date`])
|
|
322
|
+
const year = dayjs(boundary).year()
|
|
323
|
+
let month = 1
|
|
324
|
+
let date = 1
|
|
325
|
+
let hour = 0
|
|
326
|
+
let minute = 0
|
|
327
|
+
if (type === 'max') {
|
|
328
|
+
month = 12
|
|
329
|
+
// 月份的天数
|
|
330
|
+
date = dayjs(value).daysInMonth()
|
|
331
|
+
hour = 23
|
|
332
|
+
minute = 59
|
|
333
|
+
}
|
|
334
|
+
// 获取边界值,逻辑是:当年达到了边界值(最大或最小年),就检查月允许的最大和最小值,以此类推
|
|
335
|
+
if (dayjs(value).year() === year) {
|
|
336
|
+
month = dayjs(boundary).month() + 1
|
|
337
|
+
if (dayjs(value).month() + 1 === month) {
|
|
338
|
+
date = dayjs(boundary).date()
|
|
339
|
+
if (dayjs(value).date() === date) {
|
|
340
|
+
hour = dayjs(boundary).hour()
|
|
341
|
+
if (dayjs(value).hour() === hour) {
|
|
342
|
+
minute = dayjs(boundary).minute()
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return {
|
|
348
|
+
[`${type}Year`]: year,
|
|
349
|
+
[`${type}Month`]: month,
|
|
350
|
+
[`${type}Date`]: date,
|
|
351
|
+
[`${type}Hour`]: hour,
|
|
352
|
+
[`${type}Minute`]: minute
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
</script>
|
|
358
|
+
|
|
359
|
+
<style lang="scss" scoped>
|
|
360
|
+
@import '../../libs/css/components.scss';
|
|
361
|
+
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否虚线
|
|
4
|
+
dashed: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: uni.$u.props.divider.dashed
|
|
7
|
+
},
|
|
8
|
+
// 是否细线
|
|
9
|
+
hairline: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: uni.$u.props.divider.hairline
|
|
12
|
+
},
|
|
13
|
+
// 是否以点替代文字,优先于text字段起作用
|
|
14
|
+
dot: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: uni.$u.props.divider.dot
|
|
17
|
+
},
|
|
18
|
+
// 内容文本的位置,left-左边,center-中间,right-右边
|
|
19
|
+
textPosition: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: uni.$u.props.divider.textPosition
|
|
22
|
+
},
|
|
23
|
+
// 文本内容
|
|
24
|
+
text: {
|
|
25
|
+
type: [String, Number],
|
|
26
|
+
default: uni.$u.props.divider.text
|
|
27
|
+
},
|
|
28
|
+
// 文本大小
|
|
29
|
+
textSize: {
|
|
30
|
+
type: [String, Number],
|
|
31
|
+
default: uni.$u.props.divider.textSize
|
|
32
|
+
},
|
|
33
|
+
// 文本颜色
|
|
34
|
+
textColor: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: uni.$u.props.divider.textColor
|
|
37
|
+
},
|
|
38
|
+
// 线条颜色
|
|
39
|
+
lineColor: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: uni.$u.props.divider.lineColor
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-divider"
|
|
4
|
+
:style="[$u.addStyle(customStyle)]"
|
|
5
|
+
@tap="click"
|
|
6
|
+
>
|
|
7
|
+
<u-line
|
|
8
|
+
:color="lineColor"
|
|
9
|
+
:customStyle="leftLineStyle"
|
|
10
|
+
:hairline="hairline"
|
|
11
|
+
:dashed="dashed"
|
|
12
|
+
></u-line>
|
|
13
|
+
<text
|
|
14
|
+
v-if="dot"
|
|
15
|
+
class="u-divider__dot"
|
|
16
|
+
>●</text>
|
|
17
|
+
<text
|
|
18
|
+
v-else-if="text"
|
|
19
|
+
class="u-divider__text"
|
|
20
|
+
:style="[textStyle]"
|
|
21
|
+
>{{text}}</text>
|
|
22
|
+
<u-line
|
|
23
|
+
:color="lineColor"
|
|
24
|
+
:customStyle="rightLineStyle"
|
|
25
|
+
:hairline="hairline"
|
|
26
|
+
:dashed="dashed"
|
|
27
|
+
></u-line>
|
|
28
|
+
</view>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
import props from './props.js';
|
|
33
|
+
/**
|
|
34
|
+
* divider 分割线
|
|
35
|
+
* @description 区隔内容的分割线,一般用于页面底部"没有更多"的提示。
|
|
36
|
+
* @tutorial https://www.uviewui.com/components/divider.html
|
|
37
|
+
* @property {Boolean} dashed 是否虚线 (默认 false )
|
|
38
|
+
* @property {Boolean} hairline 是否细线 (默认 true )
|
|
39
|
+
* @property {Boolean} dot 是否以点替代文字,优先于text字段起作用 (默认 false )
|
|
40
|
+
* @property {String} textPosition 内容文本的位置,left-左边,center-中间,right-右边 (默认 'center' )
|
|
41
|
+
* @property {String | Number} text 文本内容
|
|
42
|
+
* @property {String | Number} textSize 文本大小 (默认 14)
|
|
43
|
+
* @property {String} textColor 文本颜色 (默认 '#909399' )
|
|
44
|
+
* @property {String} lineColor 线条颜色 (默认 '#dcdfe6' )
|
|
45
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
46
|
+
*
|
|
47
|
+
* @event {Function} click divider组件被点击时触发
|
|
48
|
+
* @example <u-divider :color="color">锦瑟无端五十弦</u-divider>
|
|
49
|
+
*/
|
|
50
|
+
export default {
|
|
51
|
+
name:'u-divider',
|
|
52
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
|
|
53
|
+
computed: {
|
|
54
|
+
textStyle() {
|
|
55
|
+
const style = {}
|
|
56
|
+
style.fontSize = uni.$u.addUnit(this.textSize)
|
|
57
|
+
style.color = this.textColor
|
|
58
|
+
return style
|
|
59
|
+
},
|
|
60
|
+
// 左边线条的的样式
|
|
61
|
+
leftLineStyle() {
|
|
62
|
+
const style = {}
|
|
63
|
+
// 如果是在左边,设置左边的宽度为固定值
|
|
64
|
+
if (this.textPosition === 'left') {
|
|
65
|
+
style.width = '80rpx'
|
|
66
|
+
} else {
|
|
67
|
+
style.flex = 1
|
|
68
|
+
}
|
|
69
|
+
return style
|
|
70
|
+
},
|
|
71
|
+
// 右边线条的的样式
|
|
72
|
+
rightLineStyle() {
|
|
73
|
+
const style = {}
|
|
74
|
+
// 如果是在右边,设置右边的宽度为固定值
|
|
75
|
+
if (this.textPosition === 'right') {
|
|
76
|
+
style.width = '80rpx'
|
|
77
|
+
} else {
|
|
78
|
+
style.flex = 1
|
|
79
|
+
}
|
|
80
|
+
return style
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
methods: {
|
|
84
|
+
// divider组件被点击时触发
|
|
85
|
+
click() {
|
|
86
|
+
this.$emit('click');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<style lang="scss" scoped>
|
|
93
|
+
@import '../../libs/css/components.scss';
|
|
94
|
+
$u-divider-margin:15px 0 !default;
|
|
95
|
+
$u-divider-text-margin:0 15px !default;
|
|
96
|
+
$u-divider-dot-font-size:12px !default;
|
|
97
|
+
$u-divider-dot-margin:0 12px !default;
|
|
98
|
+
$u-divider-dot-color: #c0c4cc !default;
|
|
99
|
+
|
|
100
|
+
.u-divider {
|
|
101
|
+
@include flex;
|
|
102
|
+
flex-direction: row;
|
|
103
|
+
align-items: center;
|
|
104
|
+
margin: $u-divider-margin;
|
|
105
|
+
|
|
106
|
+
&__text {
|
|
107
|
+
margin: $u-divider-text-margin;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&__dot {
|
|
111
|
+
font-size: $u-divider-dot-font-size;
|
|
112
|
+
margin: $u-divider-dot-margin;
|
|
113
|
+
color: $u-divider-dot-color;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 标题选中时的样式
|
|
4
|
+
activeStyle: {
|
|
5
|
+
type: [String, Object],
|
|
6
|
+
default: () => ({
|
|
7
|
+
color: '#2979ff',
|
|
8
|
+
fontSize: '14px'
|
|
9
|
+
})
|
|
10
|
+
},
|
|
11
|
+
// 标题未选中时的样式
|
|
12
|
+
inactiveStyle: {
|
|
13
|
+
type: [String, Object],
|
|
14
|
+
default: () => ({
|
|
15
|
+
color: '#606266',
|
|
16
|
+
fontSize: '14px'
|
|
17
|
+
})
|
|
18
|
+
},
|
|
19
|
+
// 点击遮罩是否关闭菜单
|
|
20
|
+
closeOnClickMask: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
// 点击当前激活项标题是否关闭菜单
|
|
25
|
+
closeOnClickSelf: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
// 过渡时间
|
|
30
|
+
duration: {
|
|
31
|
+
type: [Number, String],
|
|
32
|
+
default: 300
|
|
33
|
+
},
|
|
34
|
+
// 标题菜单的高度
|
|
35
|
+
height: {
|
|
36
|
+
type: [Number, String],
|
|
37
|
+
default: 40
|
|
38
|
+
},
|
|
39
|
+
// 是否显示下边框
|
|
40
|
+
borderBottom: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
// 标题的字体大小
|
|
45
|
+
titleSize: {
|
|
46
|
+
type: [Number, String],
|
|
47
|
+
default: 14
|
|
48
|
+
},
|
|
49
|
+
// 下拉出来的内容部分的圆角值
|
|
50
|
+
borderRadius: {
|
|
51
|
+
type: [Number, String],
|
|
52
|
+
default: 0
|
|
53
|
+
},
|
|
54
|
+
// 菜单右侧的icon图标
|
|
55
|
+
menuIcon: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'arrow-down'
|
|
58
|
+
},
|
|
59
|
+
// 菜单右侧图标的大小
|
|
60
|
+
menuIconSize: {
|
|
61
|
+
type: [Number, String],
|
|
62
|
+
default: 14
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|