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,416 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-number-box">
|
|
3
|
+
<view
|
|
4
|
+
class="u-number-box__slot"
|
|
5
|
+
@tap.stop="clickHandler('minus')"
|
|
6
|
+
@touchstart="onTouchStart('minus')"
|
|
7
|
+
@touchend.stop="clearTimeout"
|
|
8
|
+
v-if="showMinus && $slots.minus"
|
|
9
|
+
>
|
|
10
|
+
<slot name="minus" />
|
|
11
|
+
</view>
|
|
12
|
+
<view
|
|
13
|
+
v-else-if="showMinus"
|
|
14
|
+
class="u-number-box__minus"
|
|
15
|
+
@tap.stop="clickHandler('minus')"
|
|
16
|
+
@touchstart="onTouchStart('minus')"
|
|
17
|
+
@touchend.stop="clearTimeout"
|
|
18
|
+
hover-class="u-number-box__minus--hover"
|
|
19
|
+
hover-stay-time="150"
|
|
20
|
+
:class="{ 'u-number-box__minus--disabled': isDisabled('minus') }"
|
|
21
|
+
:style="[buttonStyle('minus')]"
|
|
22
|
+
>
|
|
23
|
+
<u-icon
|
|
24
|
+
name="minus"
|
|
25
|
+
:color="isDisabled('minus') ? '#c8c9cc' : '#323233'"
|
|
26
|
+
size="15"
|
|
27
|
+
bold
|
|
28
|
+
:customStyle="iconStyle"
|
|
29
|
+
></u-icon>
|
|
30
|
+
</view>
|
|
31
|
+
|
|
32
|
+
<slot name="input">
|
|
33
|
+
<input
|
|
34
|
+
:disabled="disabledInput || disabled"
|
|
35
|
+
:cursor-spacing="getCursorSpacing"
|
|
36
|
+
:class="{ 'u-number-box__input--disabled': disabled || disabledInput }"
|
|
37
|
+
v-model="currentValue"
|
|
38
|
+
class="u-number-box__input"
|
|
39
|
+
@blur="onBlur"
|
|
40
|
+
@focus="onFocus"
|
|
41
|
+
@input="onInput"
|
|
42
|
+
type="number"
|
|
43
|
+
:style="[inputStyle]"
|
|
44
|
+
/>
|
|
45
|
+
</slot>
|
|
46
|
+
<view
|
|
47
|
+
class="u-number-box__slot"
|
|
48
|
+
@tap.stop="clickHandler('plus')"
|
|
49
|
+
@touchstart="onTouchStart('plus')"
|
|
50
|
+
@touchend.stop="clearTimeout"
|
|
51
|
+
v-if="showPlus && $slots.plus"
|
|
52
|
+
>
|
|
53
|
+
<slot name="plus" />
|
|
54
|
+
</view>
|
|
55
|
+
<view
|
|
56
|
+
v-else-if="showPlus"
|
|
57
|
+
class="u-number-box__plus"
|
|
58
|
+
@tap.stop="clickHandler('plus')"
|
|
59
|
+
@touchstart="onTouchStart('plus')"
|
|
60
|
+
@touchend.stop="clearTimeout"
|
|
61
|
+
hover-class="u-number-box__plus--hover"
|
|
62
|
+
hover-stay-time="150"
|
|
63
|
+
:class="{ 'u-number-box__minus--disabled': isDisabled('plus') }"
|
|
64
|
+
:style="[buttonStyle('plus')]"
|
|
65
|
+
>
|
|
66
|
+
<u-icon
|
|
67
|
+
name="plus"
|
|
68
|
+
:color="isDisabled('plus') ? '#c8c9cc' : '#323233'"
|
|
69
|
+
size="15"
|
|
70
|
+
bold
|
|
71
|
+
:customStyle="iconStyle"
|
|
72
|
+
></u-icon>
|
|
73
|
+
</view>
|
|
74
|
+
</view>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
import props from './props.js';
|
|
79
|
+
/**
|
|
80
|
+
* numberBox 步进器
|
|
81
|
+
* @description 该组件一般用于商城购物选择物品数量的场景。
|
|
82
|
+
* @tutorial https://uviewui.com/components/numberBox.html
|
|
83
|
+
* @property {String | Number} name 步进器标识符,在change回调返回
|
|
84
|
+
* @property {String | Number} value 用于双向绑定的值,初始化时设置设为默认min值(最小值) (默认 0 )
|
|
85
|
+
* @property {String | Number} min 最小值 (默认 1 )
|
|
86
|
+
* @property {String | Number} max 最大值 (默认 Number.MAX_SAFE_INTEGER )
|
|
87
|
+
* @property {String | Number} step 加减的步长,可为小数 (默认 1 )
|
|
88
|
+
* @property {Boolean} integer 是否只允许输入整数 (默认 false )
|
|
89
|
+
* @property {Boolean} disabled 是否禁用,包括输入框,加减按钮 (默认 false )
|
|
90
|
+
* @property {Boolean} disabledInput 是否禁用输入框 (默认 false )
|
|
91
|
+
* @property {Boolean} asyncChange 是否开启异步变更,开启后需要手动控制输入值 (默认 false )
|
|
92
|
+
* @property {String | Number} inputWidth 输入框宽度,单位为px (默认 35 )
|
|
93
|
+
* @property {Boolean} showMinus 是否显示减少按钮 (默认 true )
|
|
94
|
+
* @property {Boolean} showPlus 是否显示增加按钮 (默认 true )
|
|
95
|
+
* @property {String | Number} decimalLength 显示的小数位数
|
|
96
|
+
* @property {Boolean} longPress 是否开启长按加减手势 (默认 true )
|
|
97
|
+
* @property {String} color 输入框文字和加减按钮图标的颜色 (默认 '#323233' )
|
|
98
|
+
* @property {String | Number} buttonSize 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致 (默认 30 )
|
|
99
|
+
* @property {String} bgColor 输入框和按钮的背景颜色 (默认 '#EBECEE' )
|
|
100
|
+
* @property {String | Number} cursorSpacing 指定光标于键盘的距离,避免键盘遮挡输入框,单位px (默认 100 )
|
|
101
|
+
* @property {Boolean} disablePlus 是否禁用增加按钮 (默认 false )
|
|
102
|
+
* @property {Boolean} disableMinus 是否禁用减少按钮 (默认 false )
|
|
103
|
+
* @property {Object | String} iconStyle 加减按钮图标的样式
|
|
104
|
+
*
|
|
105
|
+
* @event {Function} onFocus 输入框活动焦点
|
|
106
|
+
* @event {Function} onBlur 输入框失去焦点
|
|
107
|
+
* @event {Function} onInput 输入框值发生变化
|
|
108
|
+
* @event {Function} onChange
|
|
109
|
+
* @example <u-number-box v-model="value" @change="valChange"></u-number-box>
|
|
110
|
+
*/
|
|
111
|
+
export default {
|
|
112
|
+
name: 'u-number-box',
|
|
113
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
114
|
+
data() {
|
|
115
|
+
return {
|
|
116
|
+
// 输入框实际操作的值
|
|
117
|
+
currentValue: '',
|
|
118
|
+
// 定时器
|
|
119
|
+
longPressTimer: null
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
watch: {
|
|
123
|
+
// 多个值之间,只要一个值发生变化,都要重新检查check()函数
|
|
124
|
+
watchChange(n) {
|
|
125
|
+
this.check()
|
|
126
|
+
},
|
|
127
|
+
// 监听v-mode的变化,重新初始化内部的值
|
|
128
|
+
value(n) {
|
|
129
|
+
if (n !== this.currentValue) {
|
|
130
|
+
this.currentValue = this.format(this.value)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
computed: {
|
|
135
|
+
getCursorSpacing() {
|
|
136
|
+
// 判断传入的单位,如果为px单位,需要转成px
|
|
137
|
+
return uni.$u.getPx(this.cursorSpacing)
|
|
138
|
+
},
|
|
139
|
+
// 按钮的样式
|
|
140
|
+
buttonStyle() {
|
|
141
|
+
return (type) => {
|
|
142
|
+
const style = {
|
|
143
|
+
backgroundColor: this.bgColor,
|
|
144
|
+
height: uni.$u.addUnit(this.buttonSize),
|
|
145
|
+
color: this.color
|
|
146
|
+
}
|
|
147
|
+
if (this.isDisabled(type)) {
|
|
148
|
+
style.backgroundColor = '#f7f8fa'
|
|
149
|
+
}
|
|
150
|
+
return style
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
// 输入框的样式
|
|
154
|
+
inputStyle() {
|
|
155
|
+
const disabled = this.disabled || this.disabledInput
|
|
156
|
+
const style = {
|
|
157
|
+
color: this.color,
|
|
158
|
+
backgroundColor: this.bgColor,
|
|
159
|
+
height: uni.$u.addUnit(this.buttonSize),
|
|
160
|
+
width: uni.$u.addUnit(this.inputWidth)
|
|
161
|
+
}
|
|
162
|
+
return style
|
|
163
|
+
},
|
|
164
|
+
// 用于监听多个值发生变化
|
|
165
|
+
watchChange() {
|
|
166
|
+
return [this.integer, this.decimalLength, this.min, this.max]
|
|
167
|
+
},
|
|
168
|
+
isDisabled() {
|
|
169
|
+
return (type) => {
|
|
170
|
+
if (type === 'plus') {
|
|
171
|
+
// 在点击增加按钮情况下,判断整体的disabled,是否单独禁用增加按钮,以及当前值是否大于最大的允许值
|
|
172
|
+
return (
|
|
173
|
+
this.disabled ||
|
|
174
|
+
this.disablePlus ||
|
|
175
|
+
this.currentValue >= this.max
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
// 点击减少按钮同理
|
|
179
|
+
return (
|
|
180
|
+
this.disabled ||
|
|
181
|
+
this.disableMinus ||
|
|
182
|
+
this.currentValue <= this.min
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
mounted() {
|
|
188
|
+
this.init()
|
|
189
|
+
},
|
|
190
|
+
methods: {
|
|
191
|
+
init() {
|
|
192
|
+
this.currentValue = this.format(this.value)
|
|
193
|
+
},
|
|
194
|
+
// 格式化整理数据,限制范围
|
|
195
|
+
format(value) {
|
|
196
|
+
value = this.filter(value)
|
|
197
|
+
// 如果为空字符串,那么设置为0,同时将值转为Number类型
|
|
198
|
+
value = value === '' ? 0 : +value
|
|
199
|
+
// 对比最大最小值,取在min和max之间的值
|
|
200
|
+
value = Math.max(Math.min(this.max, value), this.min)
|
|
201
|
+
// 如果设定了最大的小数位数,使用toFixed去进行格式化
|
|
202
|
+
if (this.decimalLength !== null) {
|
|
203
|
+
value = value.toFixed(this.decimalLength)
|
|
204
|
+
}
|
|
205
|
+
return value
|
|
206
|
+
},
|
|
207
|
+
// 过滤非法的字符
|
|
208
|
+
filter(value) {
|
|
209
|
+
// 只允许0-9之间的数字,"."为小数点,"-"为负数时候使用
|
|
210
|
+
value = String(value).replace(/[^0-9.-]/g, '')
|
|
211
|
+
// 如果只允许输入整数,则过滤掉小数点后的部分
|
|
212
|
+
if (this.integer && value.indexOf('.') !== -1) {
|
|
213
|
+
value = value.split('.')[0]
|
|
214
|
+
}
|
|
215
|
+
return value;
|
|
216
|
+
},
|
|
217
|
+
check() {
|
|
218
|
+
// 格式化了之后,如果前后的值不相等,那么设置为格式化后的值
|
|
219
|
+
const val = this.format(this.currentValue);
|
|
220
|
+
if (val !== this.currentValue) {
|
|
221
|
+
this.currentValue = val
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
// 判断是否出于禁止操作状态
|
|
225
|
+
// isDisabled(type) {
|
|
226
|
+
// if (type === 'plus') {
|
|
227
|
+
// // 在点击增加按钮情况下,判断整体的disabled,是否单独禁用增加按钮,以及当前值是否大于最大的允许值
|
|
228
|
+
// return (
|
|
229
|
+
// this.disabled ||
|
|
230
|
+
// this.disablePlus ||
|
|
231
|
+
// this.currentValue >= this.max
|
|
232
|
+
// )
|
|
233
|
+
// }
|
|
234
|
+
// // 点击减少按钮同理
|
|
235
|
+
// return (
|
|
236
|
+
// this.disabled ||
|
|
237
|
+
// this.disableMinus ||
|
|
238
|
+
// this.currentValue <= this.min
|
|
239
|
+
// )
|
|
240
|
+
// },
|
|
241
|
+
// 输入框活动焦点
|
|
242
|
+
onFocus(event) {
|
|
243
|
+
this.$emit('focus', {
|
|
244
|
+
...event.detail,
|
|
245
|
+
name: this.name,
|
|
246
|
+
})
|
|
247
|
+
},
|
|
248
|
+
// 输入框失去焦点
|
|
249
|
+
onBlur(event) {
|
|
250
|
+
// 对输入值进行格式化
|
|
251
|
+
const value = this.format(event.detail.value)
|
|
252
|
+
// 发出blur事件
|
|
253
|
+
this.$emit(
|
|
254
|
+
'blur',{
|
|
255
|
+
...event.detail,
|
|
256
|
+
name: this.name,
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
},
|
|
260
|
+
// 输入框值发生变化
|
|
261
|
+
onInput(e) {
|
|
262
|
+
const {
|
|
263
|
+
value = ''
|
|
264
|
+
} = e.detail || {}
|
|
265
|
+
// 为空返回
|
|
266
|
+
if (value === '') return
|
|
267
|
+
let formatted = this.filter(value)
|
|
268
|
+
// 最大允许的小数长度
|
|
269
|
+
if (this.decimalLength !== null && formatted.indexOf('.') !== -1) {
|
|
270
|
+
const pair = formatted.split('.');
|
|
271
|
+
formatted = `${pair[0]}.${pair[1].slice(0, this.decimalLength)}`
|
|
272
|
+
}
|
|
273
|
+
formatted = this.format(formatted)
|
|
274
|
+
this.emitChange(formatted);
|
|
275
|
+
},
|
|
276
|
+
// 发出change事件
|
|
277
|
+
emitChange(value) {
|
|
278
|
+
// 如果开启了异步变更值,则不修改内部的值,需要用户手动在外部通过v-model变更
|
|
279
|
+
if (!this.asyncChange) {
|
|
280
|
+
this.$nextTick(() => {
|
|
281
|
+
this.$emit('input', value)
|
|
282
|
+
this.currentValue = value
|
|
283
|
+
this.$forceUpdate()
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
this.$emit('change', {
|
|
287
|
+
value,
|
|
288
|
+
name: this.name,
|
|
289
|
+
});
|
|
290
|
+
},
|
|
291
|
+
onChange() {
|
|
292
|
+
const {
|
|
293
|
+
type
|
|
294
|
+
} = this
|
|
295
|
+
if (this.isDisabled(type)) {
|
|
296
|
+
return this.$emit('overlimit', type)
|
|
297
|
+
}
|
|
298
|
+
const diff = type === 'minus' ? -this.step : +this.step
|
|
299
|
+
const value = this.format(this.add(+this.currentValue, diff))
|
|
300
|
+
this.emitChange(value)
|
|
301
|
+
this.$emit(type)
|
|
302
|
+
},
|
|
303
|
+
// 对值扩大后进行四舍五入,再除以扩大因子,避免出现浮点数操作的精度问题
|
|
304
|
+
add(num1, num2) {
|
|
305
|
+
const cardinal = Math.pow(10, 10);
|
|
306
|
+
return Math.round((num1 + num2) * cardinal) / cardinal
|
|
307
|
+
},
|
|
308
|
+
// 点击加减按钮
|
|
309
|
+
clickHandler(type) {
|
|
310
|
+
this.type = type
|
|
311
|
+
this.onChange()
|
|
312
|
+
},
|
|
313
|
+
longPressStep() {
|
|
314
|
+
// 每隔一段时间,重新调用longPressStep方法,实现长按加减
|
|
315
|
+
this.clearTimeout()
|
|
316
|
+
this.longPressTimer = setTimeout(() => {
|
|
317
|
+
this.onChange()
|
|
318
|
+
this.longPressStep()
|
|
319
|
+
}, 250);
|
|
320
|
+
},
|
|
321
|
+
onTouchStart(type) {
|
|
322
|
+
if (!this.longPress) return
|
|
323
|
+
this.clearTimeout()
|
|
324
|
+
this.type = type
|
|
325
|
+
// 一定时间后,默认达到长按状态
|
|
326
|
+
this.longPressTimer = setTimeout(() => {
|
|
327
|
+
this.onChange()
|
|
328
|
+
this.longPressStep()
|
|
329
|
+
}, 600)
|
|
330
|
+
},
|
|
331
|
+
// 触摸结束,清除定时器,停止长按加减
|
|
332
|
+
onTouchEnd() {
|
|
333
|
+
if (!this.longPress) return
|
|
334
|
+
this.clearTimeout()
|
|
335
|
+
},
|
|
336
|
+
// 清除定时器
|
|
337
|
+
clearTimeout() {
|
|
338
|
+
clearTimeout(this.longPressTimer)
|
|
339
|
+
this.longPressTimer = null
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
</script>
|
|
344
|
+
|
|
345
|
+
<style lang="scss" scoped>
|
|
346
|
+
@import '../../libs/css/components.scss';
|
|
347
|
+
|
|
348
|
+
$u-numberBox-hover-bgColor: #E6E6E6 !default;
|
|
349
|
+
$u-numberBox-disabled-color: #c8c9cc !default;
|
|
350
|
+
$u-numberBox-disabled-bgColor: #f7f8fa !default;
|
|
351
|
+
$u-numberBox-plus-radius: 4px !default;
|
|
352
|
+
$u-numberBox-minus-radius: 4px !default;
|
|
353
|
+
$u-numberBox-input-text-align: center !default;
|
|
354
|
+
$u-numberBox-input-font-size: 15px !default;
|
|
355
|
+
$u-numberBox-input-padding: 0 !default;
|
|
356
|
+
$u-numberBox-input-margin: 0 2px !default;
|
|
357
|
+
$u-numberBox-input-disabled-color: #c8c9cc !default;
|
|
358
|
+
$u-numberBox-input-disabled-bgColor: #f2f3f5 !default;
|
|
359
|
+
|
|
360
|
+
.u-number-box {
|
|
361
|
+
@include flex(row);
|
|
362
|
+
align-items: center;
|
|
363
|
+
|
|
364
|
+
&__slot {
|
|
365
|
+
/* #ifndef APP-NVUE */
|
|
366
|
+
touch-action: none;
|
|
367
|
+
/* #endif */
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
&__plus,
|
|
371
|
+
&__minus {
|
|
372
|
+
width: 35px;
|
|
373
|
+
@include flex;
|
|
374
|
+
justify-content: center;
|
|
375
|
+
align-items: center;
|
|
376
|
+
/* #ifndef APP-NVUE */
|
|
377
|
+
touch-action: none;
|
|
378
|
+
/* #endif */
|
|
379
|
+
|
|
380
|
+
&--hover {
|
|
381
|
+
background-color: $u-numberBox-hover-bgColor !important;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
&--disabled {
|
|
385
|
+
color: $u-numberBox-disabled-color;
|
|
386
|
+
background-color: $u-numberBox-disabled-bgColor;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
&__plus {
|
|
391
|
+
border-top-right-radius: $u-numberBox-plus-radius;
|
|
392
|
+
border-bottom-right-radius: $u-numberBox-plus-radius;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
&__minus {
|
|
396
|
+
border-top-left-radius: $u-numberBox-minus-radius;
|
|
397
|
+
border-bottom-left-radius: $u-numberBox-minus-radius;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
&__input {
|
|
401
|
+
position: relative;
|
|
402
|
+
text-align: $u-numberBox-input-text-align;
|
|
403
|
+
font-size: $u-numberBox-input-font-size;
|
|
404
|
+
padding: $u-numberBox-input-padding;
|
|
405
|
+
margin: $u-numberBox-input-margin;
|
|
406
|
+
@include flex;
|
|
407
|
+
align-items: center;
|
|
408
|
+
justify-content: center;
|
|
409
|
+
|
|
410
|
+
&--disabled {
|
|
411
|
+
color: $u-numberBox-input-disabled-color;
|
|
412
|
+
background-color: $u-numberBox-input-disabled-bgColor;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 键盘的类型,number-数字键盘,card-身份证键盘
|
|
4
|
+
mode: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: uni.$u.props.numberKeyboard.value
|
|
7
|
+
},
|
|
8
|
+
// 是否显示键盘的"."符号
|
|
9
|
+
dotDisabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: uni.$u.props.numberKeyboard.dotDisabled
|
|
12
|
+
},
|
|
13
|
+
// 是否打乱键盘按键的顺序
|
|
14
|
+
random: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: uni.$u.props.numberKeyboard.random
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-keyboard"
|
|
4
|
+
@touchmove.stop.prevent="noop"
|
|
5
|
+
>
|
|
6
|
+
<view
|
|
7
|
+
class="u-keyboard__button-wrapper"
|
|
8
|
+
v-for="(item, index) in numList"
|
|
9
|
+
:key="index"
|
|
10
|
+
>
|
|
11
|
+
<view
|
|
12
|
+
class="u-keyboard__button-wrapper__button"
|
|
13
|
+
:style="[itemStyle(index)]"
|
|
14
|
+
@tap="keyboardClick(item)"
|
|
15
|
+
hover-class="u-hover-class"
|
|
16
|
+
:hover-stay-time="200"
|
|
17
|
+
>
|
|
18
|
+
<text class="u-keyboard__button-wrapper__button__text">{{ item }}</text>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
<view
|
|
22
|
+
class="u-keyboard__button-wrapper"
|
|
23
|
+
>
|
|
24
|
+
<view
|
|
25
|
+
class="u-keyboard__button-wrapper__button u-keyboard__button-wrapper__button--gray"
|
|
26
|
+
hover-class="u-hover-class"
|
|
27
|
+
:hover-stay-time="200"
|
|
28
|
+
@touchstart.stop="backspaceClick"
|
|
29
|
+
@touchend="clearTimer"
|
|
30
|
+
>
|
|
31
|
+
<u-icon
|
|
32
|
+
name="backspace"
|
|
33
|
+
color="#303133"
|
|
34
|
+
size="28"
|
|
35
|
+
></u-icon>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import props from './props.js';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* keyboard 键盘组件
|
|
46
|
+
* @description
|
|
47
|
+
* @tutorial
|
|
48
|
+
* @property {String} mode 键盘的类型,number-数字键盘,card-身份证键盘
|
|
49
|
+
* @property {Boolean} dotDisabled 是否显示键盘的"."符号
|
|
50
|
+
* @property {Boolean} random 是否打乱键盘按键的顺序
|
|
51
|
+
* @event {Function} change 点击键盘触发
|
|
52
|
+
* @event {Function} backspace 点击退格键触发
|
|
53
|
+
* @example
|
|
54
|
+
*/
|
|
55
|
+
export default {
|
|
56
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
57
|
+
data() {
|
|
58
|
+
return {
|
|
59
|
+
backspace: 'backspace', // 退格键内容
|
|
60
|
+
dot: '.', // 点
|
|
61
|
+
timer: null, // 长按多次删除的事件监听
|
|
62
|
+
cardX: 'X' // 身份证的X符号
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
computed: {
|
|
66
|
+
// 键盘需要显示的内容
|
|
67
|
+
numList() {
|
|
68
|
+
let tmp = [];
|
|
69
|
+
if (this.dotDisabled && this.mode == 'number') {
|
|
70
|
+
if (!this.random) {
|
|
71
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
72
|
+
} else {
|
|
73
|
+
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
|
74
|
+
}
|
|
75
|
+
} else if (!this.dotDisabled && this.mode == 'number') {
|
|
76
|
+
if (!this.random) {
|
|
77
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
|
|
78
|
+
} else {
|
|
79
|
+
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
|
|
80
|
+
}
|
|
81
|
+
} else if (this.mode == 'card') {
|
|
82
|
+
if (!this.random) {
|
|
83
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
|
|
84
|
+
} else {
|
|
85
|
+
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
// 按键的样式,在非乱序&&数字键盘&&不显示点按钮时,index为9时,按键占位两个空间
|
|
90
|
+
itemStyle() {
|
|
91
|
+
return index => {
|
|
92
|
+
let style = {};
|
|
93
|
+
if (this.mode == 'number' && this.dotDisabled && index == 9) style.width = '464rpx';
|
|
94
|
+
return style;
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
// 是否让按键显示灰色,只在非乱序&&数字键盘&&且允许点按键的时候
|
|
98
|
+
btnBgGray() {
|
|
99
|
+
return index => {
|
|
100
|
+
if (!this.random && index == 9 && (this.mode != 'number' || (this.mode == 'number' && !this
|
|
101
|
+
.dotDisabled))) return true;
|
|
102
|
+
else return false;
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
created() {
|
|
107
|
+
|
|
108
|
+
},
|
|
109
|
+
methods: {
|
|
110
|
+
// 点击退格键
|
|
111
|
+
backspaceClick() {
|
|
112
|
+
this.$emit('backspace');
|
|
113
|
+
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
|
|
114
|
+
this.timer = null;
|
|
115
|
+
this.timer = setInterval(() => {
|
|
116
|
+
this.$emit('backspace');
|
|
117
|
+
}, 250);
|
|
118
|
+
},
|
|
119
|
+
clearTimer() {
|
|
120
|
+
clearInterval(this.timer);
|
|
121
|
+
this.timer = null;
|
|
122
|
+
},
|
|
123
|
+
// 获取键盘显示的内容
|
|
124
|
+
keyboardClick(val) {
|
|
125
|
+
// 允许键盘显示点模式和触发非点按键时,将内容转为数字类型
|
|
126
|
+
if (!this.dotDisabled && val != this.dot && val != this.cardX) val = Number(val);
|
|
127
|
+
this.$emit('change', val);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style lang="scss" scoped>
|
|
134
|
+
@import "../../libs/css/components.scss";
|
|
135
|
+
$u-number-keyboard-background-color:rgb(224, 228, 230) !default;
|
|
136
|
+
$u-number-keyboard-padding:8px 10rpx 8px 10rpx !default;
|
|
137
|
+
$u-number-keyboard-button-width:222rpx !default;
|
|
138
|
+
$u-number-keyboard-button-margin:4px 6rpx !default;
|
|
139
|
+
$u-number-keyboard-button-border-top-left-radius:4px !default;
|
|
140
|
+
$u-number-keyboard-button-border-top-right-radius:4px !default;
|
|
141
|
+
$u-number-keyboard-button-border-bottom-left-radius:4px !default;
|
|
142
|
+
$u-number-keyboard-button-border-bottom-right-radius:4px !default;
|
|
143
|
+
$u-number-keyboard-button-height: 90rpx!default;
|
|
144
|
+
$u-number-keyboard-button-background-color:#FFFFFF !default;
|
|
145
|
+
$u-number-keyboard-button-box-shadow:0 2px 0px #BBBCBE !default;
|
|
146
|
+
$u-number-keyboard-text-font-size:20px !default;
|
|
147
|
+
$u-number-keyboard-text-font-weight:500 !default;
|
|
148
|
+
$u-number-keyboard-text-color:$u-main-color !default;
|
|
149
|
+
$u-number-keyboard-gray-background-color:rgb(200, 202, 210) !default;
|
|
150
|
+
$u-number-keyboard-u-hover-class-background-color: #BBBCC6 !default;
|
|
151
|
+
|
|
152
|
+
.u-keyboard {
|
|
153
|
+
@include flex;
|
|
154
|
+
flex-direction: row;
|
|
155
|
+
justify-content: space-around;
|
|
156
|
+
background-color: $u-number-keyboard-background-color;
|
|
157
|
+
flex-wrap: wrap;
|
|
158
|
+
padding: $u-number-keyboard-padding;
|
|
159
|
+
|
|
160
|
+
&__button-wrapper {
|
|
161
|
+
box-shadow: $u-number-keyboard-button-box-shadow;
|
|
162
|
+
margin: $u-number-keyboard-button-margin;
|
|
163
|
+
border-top-left-radius: $u-number-keyboard-button-border-top-left-radius;
|
|
164
|
+
border-top-right-radius: $u-number-keyboard-button-border-top-right-radius;
|
|
165
|
+
border-bottom-left-radius: $u-number-keyboard-button-border-bottom-left-radius;
|
|
166
|
+
border-bottom-right-radius: $u-number-keyboard-button-border-bottom-right-radius;
|
|
167
|
+
|
|
168
|
+
&__button {
|
|
169
|
+
width: $u-number-keyboard-button-width;
|
|
170
|
+
height: $u-number-keyboard-button-height;
|
|
171
|
+
background-color: $u-number-keyboard-button-background-color;
|
|
172
|
+
@include flex;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
align-items: center;
|
|
175
|
+
border-top-left-radius: $u-number-keyboard-button-border-top-left-radius;
|
|
176
|
+
border-top-right-radius: $u-number-keyboard-button-border-top-right-radius;
|
|
177
|
+
border-bottom-left-radius: $u-number-keyboard-button-border-bottom-left-radius;
|
|
178
|
+
border-bottom-right-radius: $u-number-keyboard-button-border-bottom-right-radius;
|
|
179
|
+
|
|
180
|
+
&__text {
|
|
181
|
+
font-size: $u-number-keyboard-text-font-size;
|
|
182
|
+
font-weight: $u-number-keyboard-text-font-weight;
|
|
183
|
+
color: $u-number-keyboard-text-color;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
&--gray {
|
|
187
|
+
background-color: $u-number-keyboard-gray-background-color;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.u-hover-class {
|
|
194
|
+
background-color: $u-number-keyboard-u-hover-class-background-color;
|
|
195
|
+
}
|
|
196
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 是否显示遮罩
|
|
4
|
+
show: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: uni.$u.props.overlay.show
|
|
7
|
+
},
|
|
8
|
+
// 层级z-index
|
|
9
|
+
zIndex: {
|
|
10
|
+
type: [String, Number],
|
|
11
|
+
default: uni.$u.props.overlay.zIndex
|
|
12
|
+
},
|
|
13
|
+
// 遮罩的过渡时间,单位为ms
|
|
14
|
+
duration: {
|
|
15
|
+
type: [String, Number],
|
|
16
|
+
default: uni.$u.props.overlay.duration
|
|
17
|
+
},
|
|
18
|
+
// 不透明度值,当做rgba的第四个参数
|
|
19
|
+
opacity: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: uni.$u.props.overlay.opacity
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|