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,369 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="u-input"
|
|
4
|
+
:class="inputClass"
|
|
5
|
+
:style="[wrapperStyle]"
|
|
6
|
+
>
|
|
7
|
+
<view class="u-input__content">
|
|
8
|
+
<view
|
|
9
|
+
class="u-input__content__prefix-icon"
|
|
10
|
+
v-if="prefixIcon || $slots.prefix"
|
|
11
|
+
>
|
|
12
|
+
<slot name="prefix">
|
|
13
|
+
<u-icon
|
|
14
|
+
:name="prefixIcon"
|
|
15
|
+
size="18"
|
|
16
|
+
:customStyle="prefixIconStyle"
|
|
17
|
+
></u-icon>
|
|
18
|
+
</slot>
|
|
19
|
+
</view>
|
|
20
|
+
<view
|
|
21
|
+
class="u-input__content__field-wrapper"
|
|
22
|
+
@tap="clickHandler"
|
|
23
|
+
>
|
|
24
|
+
<!-- 根据uni-app的input组件文档,H5和APP中只要声明了password参数(无论true还是false),type均失效,此时
|
|
25
|
+
为了防止type=number时,又存在password属性,type无效,此时需要设置password为undefined
|
|
26
|
+
-->
|
|
27
|
+
<input
|
|
28
|
+
class="u-input__content__field-wrapper__field"
|
|
29
|
+
:style="[inputStyle]"
|
|
30
|
+
:type="type"
|
|
31
|
+
:focus="focus"
|
|
32
|
+
:cursor="cursor"
|
|
33
|
+
:value="innerValue"
|
|
34
|
+
:auto-blur="autoBlur"
|
|
35
|
+
:disabled="disabled || readonly"
|
|
36
|
+
:maxlength="maxlength"
|
|
37
|
+
:placeholder="placeholder"
|
|
38
|
+
:placeholder-style="placeholderStyle"
|
|
39
|
+
:placeholder-class="placeholderClass"
|
|
40
|
+
:confirm-type="confirmType"
|
|
41
|
+
:confirm-hold="confirmHold"
|
|
42
|
+
:hold-keyboard="holdKeyboard"
|
|
43
|
+
:cursor-spacing="cursorSpacing"
|
|
44
|
+
:adjust-position="adjustPosition"
|
|
45
|
+
:selection-end="selectionEnd"
|
|
46
|
+
:selection-start="selectionStart"
|
|
47
|
+
:password="password || type === 'password' || false"
|
|
48
|
+
:ignoreCompositionEvent="ignoreCompositionEvent"
|
|
49
|
+
@input="onInput"
|
|
50
|
+
@blur="onBlur"
|
|
51
|
+
@focus="onFocus"
|
|
52
|
+
@confirm="onConfirm"
|
|
53
|
+
@keyboardheightchange="onkeyboardheightchange"
|
|
54
|
+
/>
|
|
55
|
+
</view>
|
|
56
|
+
<view
|
|
57
|
+
class="u-input__content__clear"
|
|
58
|
+
v-if="isShowClear"
|
|
59
|
+
@tap="onClear"
|
|
60
|
+
>
|
|
61
|
+
<u-icon
|
|
62
|
+
name="close"
|
|
63
|
+
size="11"
|
|
64
|
+
color="#ffffff"
|
|
65
|
+
customStyle="line-height: 12px"
|
|
66
|
+
></u-icon>
|
|
67
|
+
</view>
|
|
68
|
+
<view
|
|
69
|
+
class="u-input__content__subfix-icon"
|
|
70
|
+
v-if="suffixIcon || $slots.suffix"
|
|
71
|
+
>
|
|
72
|
+
<slot name="suffix">
|
|
73
|
+
<u-icon
|
|
74
|
+
:name="suffixIcon"
|
|
75
|
+
size="18"
|
|
76
|
+
:customStyle="suffixIconStyle"
|
|
77
|
+
></u-icon>
|
|
78
|
+
</slot>
|
|
79
|
+
</view>
|
|
80
|
+
</view>
|
|
81
|
+
</view>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
import props from "./props.js";
|
|
86
|
+
/**
|
|
87
|
+
* Input 输入框
|
|
88
|
+
* @description 此组件为一个输入框,默认没有边框和样式,是专门为配合表单组件u-form而设计的,利用它可以快速实现表单验证,输入内容,下拉选择等功能。
|
|
89
|
+
* @tutorial https://uviewui.com/components/input.html
|
|
90
|
+
* @property {String | Number} value 输入的值
|
|
91
|
+
* @property {String} type 输入框类型,见上方说明 ( 默认 'text' )
|
|
92
|
+
* @property {Boolean} fixed 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true,兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序 ( 默认 false )
|
|
93
|
+
* @property {Boolean} disabled 是否禁用输入框 ( 默认 false )
|
|
94
|
+
* @property {String} disabledColor 禁用状态时的背景色( 默认 '#f5f7fa' )
|
|
95
|
+
* @property {Boolean} clearable 是否显示清除控件 ( 默认 false )
|
|
96
|
+
* @property {Boolean} password 是否密码类型 ( 默认 false )
|
|
97
|
+
* @property {String | Number} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度 ( 默认 -1 )
|
|
98
|
+
* @property {String} placeholder 输入框为空时的占位符
|
|
99
|
+
* @property {String} placeholderClass 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ ( 默认 'input-placeholder' )
|
|
100
|
+
* @property {String | Object} placeholderStyle 指定placeholder的样式,字符串/对象形式,如"color: red;"
|
|
101
|
+
* @property {Boolean} showWordLimit 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效 ( 默认 false )
|
|
102
|
+
* @property {String} confirmType 设置右下角按钮的文字,兼容性详见uni-app文档 ( 默认 'done' )
|
|
103
|
+
* @property {Boolean} confirmHold 点击键盘右下角按钮时是否保持键盘不收起,H5无效 ( 默认 false )
|
|
104
|
+
* @property {Boolean} holdKeyboard focus时,点击页面的时候不收起键盘,微信小程序有效 ( 默认 false )
|
|
105
|
+
* @property {Boolean} focus 自动获取焦点,在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 ( 默认 false )
|
|
106
|
+
* @property {Boolean} autoBlur 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 ( 默认 false )
|
|
107
|
+
* @property {Boolean} disableDefaultPadding 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 ( 默认 false )
|
|
108
|
+
* @property {String | Number} cursor 指定focus时光标的位置( 默认 -1 )
|
|
109
|
+
* @property {String | Number} cursorSpacing 输入框聚焦时底部与键盘的距离 ( 默认 30 )
|
|
110
|
+
* @property {String | Number} selectionStart 光标起始位置,自动聚集时有效,需与selection-end搭配使用 ( 默认 -1 )
|
|
111
|
+
* @property {String | Number} selectionEnd 光标结束位置,自动聚集时有效,需与selection-start搭配使用 ( 默认 -1 )
|
|
112
|
+
* @property {Boolean} adjustPosition 键盘弹起时,是否自动上推页面 ( 默认 true )
|
|
113
|
+
* @property {String} inputAlign 输入框内容对齐方式( 默认 'left' )
|
|
114
|
+
* @property {String | Number} fontSize 输入框字体的大小 ( 默认 '15px' )
|
|
115
|
+
* @property {String} color 输入框字体颜色 ( 默认 '#303133' )
|
|
116
|
+
* @property {Function} formatter 内容式化函数
|
|
117
|
+
* @property {String} prefixIcon 输入框前置图标
|
|
118
|
+
* @property {String | Object} prefixIconStyle 前置图标样式,对象或字符串
|
|
119
|
+
* @property {String} suffixIcon 输入框后置图标
|
|
120
|
+
* @property {String | Object} suffixIconStyle 后置图标样式,对象或字符串
|
|
121
|
+
* @property {String} border 边框类型,surround-四周边框,bottom-底部边框,none-无边框 ( 默认 'surround' )
|
|
122
|
+
* @property {Boolean} readonly 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 ( 默认 false )
|
|
123
|
+
* @property {String} shape 输入框形状,circle-圆形,square-方形 ( 默认 'square' )
|
|
124
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
125
|
+
* @property {Boolean} ignoreCompositionEvent 是否忽略组件内对文本合成系统事件的处理。
|
|
126
|
+
* @example <u-input v-model="value" :password="true" suffix-icon="lock-fill" />
|
|
127
|
+
*/
|
|
128
|
+
export default {
|
|
129
|
+
name: "u-input",
|
|
130
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
|
131
|
+
data() {
|
|
132
|
+
return {
|
|
133
|
+
// 输入框的值
|
|
134
|
+
innerValue: "",
|
|
135
|
+
// 是否处于获得焦点状态
|
|
136
|
+
focused: false,
|
|
137
|
+
// value是否第一次变化,在watch中,由于加入immediate属性,会在第一次触发,此时不应该认为value发生了变化
|
|
138
|
+
firstChange: true,
|
|
139
|
+
// value绑定值的变化是由内部还是外部引起的
|
|
140
|
+
changeFromInner: false,
|
|
141
|
+
// 过滤处理方法
|
|
142
|
+
innerFormatter: value => value
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
watch: {
|
|
146
|
+
value: {
|
|
147
|
+
immediate: true,
|
|
148
|
+
handler(newVal, oldVal) {
|
|
149
|
+
this.innerValue = newVal;
|
|
150
|
+
/* #ifdef H5 */
|
|
151
|
+
// 在H5中,外部value变化后,修改input中的值,不会触发@input事件,此时手动调用值变化方法
|
|
152
|
+
if (
|
|
153
|
+
this.firstChange === false &&
|
|
154
|
+
this.changeFromInner === false
|
|
155
|
+
) {
|
|
156
|
+
this.valueChange();
|
|
157
|
+
}
|
|
158
|
+
/* #endif */
|
|
159
|
+
this.firstChange = false;
|
|
160
|
+
// 重置changeFromInner的值为false,标识下一次引起默认为外部引起的
|
|
161
|
+
this.changeFromInner = false;
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
computed: {
|
|
166
|
+
// 是否显示清除控件
|
|
167
|
+
isShowClear() {
|
|
168
|
+
const { clearable, readonly, focused, innerValue } = this;
|
|
169
|
+
return !!clearable && !readonly && !!focused && innerValue !== "";
|
|
170
|
+
},
|
|
171
|
+
// 组件的类名
|
|
172
|
+
inputClass() {
|
|
173
|
+
let classes = [],
|
|
174
|
+
{ border, disabled, shape } = this;
|
|
175
|
+
border === "surround" &&
|
|
176
|
+
(classes = classes.concat(["u-border", "u-input--radius"]));
|
|
177
|
+
classes.push(`u-input--${shape}`);
|
|
178
|
+
border === "bottom" &&
|
|
179
|
+
(classes = classes.concat([
|
|
180
|
+
"u-border-bottom",
|
|
181
|
+
"u-input--no-radius",
|
|
182
|
+
]));
|
|
183
|
+
return classes.join(" ");
|
|
184
|
+
},
|
|
185
|
+
// 组件的样式
|
|
186
|
+
wrapperStyle() {
|
|
187
|
+
const style = {};
|
|
188
|
+
// 禁用状态下,被背景色加上对应的样式
|
|
189
|
+
if (this.disabled) {
|
|
190
|
+
style.backgroundColor = this.disabledColor;
|
|
191
|
+
}
|
|
192
|
+
// 无边框时,去除内边距
|
|
193
|
+
if (this.border === "none") {
|
|
194
|
+
style.padding = "0";
|
|
195
|
+
} else {
|
|
196
|
+
// 由于uni-app的iOS开发者能力有限,导致需要分开写才有效
|
|
197
|
+
style.paddingTop = "6px";
|
|
198
|
+
style.paddingBottom = "6px";
|
|
199
|
+
style.paddingLeft = "9px";
|
|
200
|
+
style.paddingRight = "9px";
|
|
201
|
+
}
|
|
202
|
+
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
|
|
203
|
+
},
|
|
204
|
+
// 输入框的样式
|
|
205
|
+
inputStyle() {
|
|
206
|
+
const style = {
|
|
207
|
+
color: this.color,
|
|
208
|
+
fontSize: uni.$u.addUnit(this.fontSize),
|
|
209
|
+
textAlign: this.inputAlign
|
|
210
|
+
};
|
|
211
|
+
return style;
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
methods: {
|
|
215
|
+
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
|
|
216
|
+
setFormatter(e) {
|
|
217
|
+
this.innerFormatter = e
|
|
218
|
+
},
|
|
219
|
+
// 当键盘输入时,触发input事件
|
|
220
|
+
onInput(e) {
|
|
221
|
+
let { value = "" } = e.detail || {};
|
|
222
|
+
// 格式化过滤方法
|
|
223
|
+
const formatter = this.formatter || this.innerFormatter
|
|
224
|
+
const formatValue = formatter(value)
|
|
225
|
+
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
|
|
226
|
+
this.innerValue = value
|
|
227
|
+
this.$nextTick(() => {
|
|
228
|
+
this.innerValue = formatValue;
|
|
229
|
+
this.valueChange();
|
|
230
|
+
})
|
|
231
|
+
},
|
|
232
|
+
// 输入框失去焦点时触发
|
|
233
|
+
onBlur(event) {
|
|
234
|
+
this.$emit("blur", event.detail.value);
|
|
235
|
+
// H5端的blur会先于点击清除控件的点击click事件触发,导致focused
|
|
236
|
+
// 瞬间为false,从而隐藏了清除控件而无法被点击到
|
|
237
|
+
uni.$u.sleep(50).then(() => {
|
|
238
|
+
this.focused = false;
|
|
239
|
+
});
|
|
240
|
+
// 尝试调用u-form的验证方法
|
|
241
|
+
uni.$u.formValidate(this, "blur");
|
|
242
|
+
},
|
|
243
|
+
// 输入框聚焦时触发
|
|
244
|
+
onFocus(e) {
|
|
245
|
+
this.focused = true;
|
|
246
|
+
this.$emit("focus", e);
|
|
247
|
+
},
|
|
248
|
+
// 点击完成按钮时触发
|
|
249
|
+
onConfirm(event) {
|
|
250
|
+
this.$emit("confirm", this.innerValue);
|
|
251
|
+
},
|
|
252
|
+
// 键盘高度发生变化的时候触发此事件
|
|
253
|
+
// 兼容性:微信小程序2.7.0+、App 3.1.0+
|
|
254
|
+
onkeyboardheightchange(e) {
|
|
255
|
+
this.$emit("keyboardheightchange", e);
|
|
256
|
+
},
|
|
257
|
+
// 内容发生变化,进行处理
|
|
258
|
+
valueChange() {
|
|
259
|
+
const value = this.innerValue;
|
|
260
|
+
this.$nextTick(() => {
|
|
261
|
+
this.$emit("input", value);
|
|
262
|
+
// 标识value值的变化是由内部引起的
|
|
263
|
+
this.changeFromInner = true;
|
|
264
|
+
this.$emit("change", value);
|
|
265
|
+
// 尝试调用u-form的验证方法
|
|
266
|
+
uni.$u.formValidate(this, "change");
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
// 点击清除控件
|
|
270
|
+
onClear() {
|
|
271
|
+
this.innerValue = "";
|
|
272
|
+
this.$nextTick(() => {
|
|
273
|
+
this.valueChange();
|
|
274
|
+
this.$emit("clear");
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* 在安卓nvue上,事件无法冒泡
|
|
279
|
+
* 在某些时间,我们希望监听u-from-item的点击事件,此时会导致点击u-form-item内的u-input后
|
|
280
|
+
* 无法触发u-form-item的点击事件,这里通过手动调用u-form-item的方法进行触发
|
|
281
|
+
*/
|
|
282
|
+
clickHandler() {
|
|
283
|
+
// #ifdef APP-NVUE
|
|
284
|
+
if (uni.$u.os() === "android") {
|
|
285
|
+
const formItem = uni.$u.$parent.call(this, "u-form-item");
|
|
286
|
+
if (formItem) {
|
|
287
|
+
formItem.clickHandler();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// #endif
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
</script>
|
|
295
|
+
|
|
296
|
+
<style lang="scss" scoped>
|
|
297
|
+
@import "../../libs/css/components.scss";
|
|
298
|
+
|
|
299
|
+
.u-input {
|
|
300
|
+
@include flex(row);
|
|
301
|
+
align-items: center;
|
|
302
|
+
justify-content: space-between;
|
|
303
|
+
flex: 1;
|
|
304
|
+
|
|
305
|
+
// #ifdef H5
|
|
306
|
+
// 处理H5下,input输入框disabled状态下,无法触发click事件问题
|
|
307
|
+
::v-deep .uni-input-input:disabled {
|
|
308
|
+
pointer-events: none;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// #endif
|
|
312
|
+
|
|
313
|
+
&--radius,
|
|
314
|
+
&--square {
|
|
315
|
+
border-radius: 4px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
&--no-radius {
|
|
319
|
+
border-radius: 0;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&--circle {
|
|
323
|
+
border-radius: 100px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&__content {
|
|
327
|
+
flex: 1;
|
|
328
|
+
@include flex(row);
|
|
329
|
+
align-items: center;
|
|
330
|
+
justify-content: space-between;
|
|
331
|
+
|
|
332
|
+
&__field-wrapper {
|
|
333
|
+
position: relative;
|
|
334
|
+
@include flex(row);
|
|
335
|
+
margin: 0;
|
|
336
|
+
flex: 1;
|
|
337
|
+
|
|
338
|
+
&__field {
|
|
339
|
+
line-height: 26px;
|
|
340
|
+
text-align: left;
|
|
341
|
+
color: $u-main-color;
|
|
342
|
+
height: 24px;
|
|
343
|
+
font-size: 15px;
|
|
344
|
+
flex: 1;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
&__clear {
|
|
349
|
+
width: 20px;
|
|
350
|
+
height: 20px;
|
|
351
|
+
border-radius: 100px;
|
|
352
|
+
background-color: #c6c7cb;
|
|
353
|
+
@include flex(row);
|
|
354
|
+
align-items: center;
|
|
355
|
+
justify-content: center;
|
|
356
|
+
transform: scale(0.82);
|
|
357
|
+
margin-left: 4px;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
&__subfix-icon {
|
|
361
|
+
margin-left: 4px;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
&__prefix-icon {
|
|
365
|
+
margin-right: 4px;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 键盘的类型,number-数字键盘,card-身份证键盘,car-车牌号键盘
|
|
4
|
+
mode: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: uni.$u.props.keyboard.mode
|
|
7
|
+
},
|
|
8
|
+
// 是否显示键盘的"."符号
|
|
9
|
+
dotDisabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: uni.$u.props.keyboard.dotDisabled
|
|
12
|
+
},
|
|
13
|
+
// 是否显示顶部工具条
|
|
14
|
+
tooltip: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: uni.$u.props.keyboard.tooltip
|
|
17
|
+
},
|
|
18
|
+
// 是否显示工具条中间的提示
|
|
19
|
+
showTips: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: uni.$u.props.keyboard.showTips
|
|
22
|
+
},
|
|
23
|
+
// 工具条中间的提示文字
|
|
24
|
+
tips: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: uni.$u.props.keyboard.tips
|
|
27
|
+
},
|
|
28
|
+
// 是否显示工具条左边的"取消"按钮
|
|
29
|
+
showCancel: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: uni.$u.props.keyboard.showCancel
|
|
32
|
+
},
|
|
33
|
+
// 是否显示工具条右边的"完成"按钮
|
|
34
|
+
showConfirm: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: uni.$u.props.keyboard.showConfirm
|
|
37
|
+
},
|
|
38
|
+
// 是否打乱键盘按键的顺序
|
|
39
|
+
random: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: uni.$u.props.keyboard.random
|
|
42
|
+
},
|
|
43
|
+
// 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距
|
|
44
|
+
safeAreaInsetBottom: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: uni.$u.props.keyboard.safeAreaInsetBottom
|
|
47
|
+
},
|
|
48
|
+
// 是否允许通过点击遮罩关闭键盘
|
|
49
|
+
closeOnClickOverlay: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: uni.$u.props.keyboard.closeOnClickOverlay
|
|
52
|
+
},
|
|
53
|
+
// 控制键盘的弹出与收起
|
|
54
|
+
show: {
|
|
55
|
+
type: Boolean,
|
|
56
|
+
default: uni.$u.props.keyboard.show
|
|
57
|
+
},
|
|
58
|
+
// 是否显示遮罩,某些时候数字键盘时,用户希望看到自己的数值,所以可能不想要遮罩
|
|
59
|
+
overlay: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: uni.$u.props.keyboard.overlay
|
|
62
|
+
},
|
|
63
|
+
// z-index值
|
|
64
|
+
zIndex: {
|
|
65
|
+
type: [String, Number],
|
|
66
|
+
default: uni.$u.props.keyboard.zIndex
|
|
67
|
+
},
|
|
68
|
+
// 取消按钮的文字
|
|
69
|
+
cancelText: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: uni.$u.props.keyboard.cancelText
|
|
72
|
+
},
|
|
73
|
+
// 确认按钮的文字
|
|
74
|
+
confirmText: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: uni.$u.props.keyboard.confirmText
|
|
77
|
+
},
|
|
78
|
+
// 输入一个中文后,是否自动切换到英文
|
|
79
|
+
autoChange: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: uni.$u.props.keyboard.autoChange
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<u-popup
|
|
3
|
+
:overlay="overlay"
|
|
4
|
+
:closeOnClickOverlay="closeOnClickOverlay"
|
|
5
|
+
mode="bottom"
|
|
6
|
+
:popup="false"
|
|
7
|
+
:show="show"
|
|
8
|
+
:safeAreaInsetBottom="safeAreaInsetBottom"
|
|
9
|
+
@close="popupClose"
|
|
10
|
+
:zIndex="zIndex"
|
|
11
|
+
:customStyle="{
|
|
12
|
+
backgroundColor: 'rgb(214, 218, 220)'
|
|
13
|
+
}"
|
|
14
|
+
>
|
|
15
|
+
<view class="u-keyboard">
|
|
16
|
+
<slot />
|
|
17
|
+
<view
|
|
18
|
+
class="u-keyboard__tooltip"
|
|
19
|
+
v-if="tooltip"
|
|
20
|
+
>
|
|
21
|
+
<view
|
|
22
|
+
hover-class="u-hover-class"
|
|
23
|
+
:hover-stay-time="100"
|
|
24
|
+
>
|
|
25
|
+
<text
|
|
26
|
+
class="u-keyboard__tooltip__item u-keyboard__tooltip__cancel"
|
|
27
|
+
v-if="showCancel"
|
|
28
|
+
@tap="onCancel"
|
|
29
|
+
>{{showCancel && cancelText}}</text>
|
|
30
|
+
</view>
|
|
31
|
+
<view>
|
|
32
|
+
<text
|
|
33
|
+
v-if="showTips"
|
|
34
|
+
class="u-keyboard__tooltip__item u-keyboard__tooltip__tips"
|
|
35
|
+
>{{tips ? tips : mode == 'number' ? '数字键盘' : mode == 'card' ? '身份证键盘' : '车牌号键盘'}}</text>
|
|
36
|
+
</view>
|
|
37
|
+
<view
|
|
38
|
+
hover-class="u-hover-class"
|
|
39
|
+
:hover-stay-time="100"
|
|
40
|
+
>
|
|
41
|
+
<text
|
|
42
|
+
v-if="showConfirm"
|
|
43
|
+
@tap="onConfirm"
|
|
44
|
+
class="u-keyboard__tooltip__item u-keyboard__tooltip__submit"
|
|
45
|
+
hover-class="u-hover-class"
|
|
46
|
+
>{{showConfirm && confirmText}}</text>
|
|
47
|
+
</view>
|
|
48
|
+
</view>
|
|
49
|
+
<template v-if="mode == 'number' || mode == 'card'">
|
|
50
|
+
<u-number-keyboard
|
|
51
|
+
:random="random"
|
|
52
|
+
@backspace="backspace"
|
|
53
|
+
@change="change"
|
|
54
|
+
:mode="mode"
|
|
55
|
+
:dotDisabled="dotDisabled"
|
|
56
|
+
></u-number-keyboard>
|
|
57
|
+
</template>
|
|
58
|
+
<template v-else>
|
|
59
|
+
<u-car-keyboard
|
|
60
|
+
:random="random"
|
|
61
|
+
:autoChange="autoChange"
|
|
62
|
+
@backspace="backspace"
|
|
63
|
+
@change="change"
|
|
64
|
+
></u-car-keyboard>
|
|
65
|
+
</template>
|
|
66
|
+
</view>
|
|
67
|
+
</u-popup>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
import props from './props.js';
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* keyboard 键盘
|
|
75
|
+
* @description 此为uViw自定义的键盘面板,内含了数字键盘,车牌号键,身份证号键盘3中模式,都有可以打乱按键顺序的选项。
|
|
76
|
+
* @tutorial https://www.uviewui.com/components/keyboard.html
|
|
77
|
+
* @property {String} mode 键盘类型,见官网基本使用的说明 (默认 'number' )
|
|
78
|
+
* @property {Boolean} dotDisabled 是否显示"."按键,只在mode=number时有效 (默认 false )
|
|
79
|
+
* @property {Boolean} tooltip 是否显示键盘顶部工具条 (默认 true )
|
|
80
|
+
* @property {Boolean} showTips 是否显示工具条中间的提示 (默认 true )
|
|
81
|
+
* @property {String} tips 工具条中间的提示文字,见上方基本使用的说明,如不需要,请传""空字符
|
|
82
|
+
* @property {Boolean} showCancel 是否显示工具条左边的"取消"按钮 (默认 true )
|
|
83
|
+
* @property {Boolean} showConfirm 是否显示工具条右边的"完成"按钮( 默认 true )
|
|
84
|
+
* @property {Boolean} random 是否打乱键盘按键的顺序 (默认 false )
|
|
85
|
+
* @property {Boolean} safeAreaInsetBottom 是否开启底部安全区适配 (默认 true )
|
|
86
|
+
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩收起键盘 (默认 true )
|
|
87
|
+
* @property {Boolean} show 控制键盘的弹出与收起(默认 false )
|
|
88
|
+
* @property {Boolean} overlay 是否显示遮罩 (默认 true )
|
|
89
|
+
* @property {String | Number} zIndex 弹出键盘的z-index值 (默认 1075 )
|
|
90
|
+
* @property {String} cancelText 取消按钮的文字 (默认 '取消' )
|
|
91
|
+
* @property {String} confirmText 确认按钮的文字 (默认 '确认' )
|
|
92
|
+
* @property {Object} customStyle 自定义样式,对象形式
|
|
93
|
+
* @event {Function} change 按键被点击(不包含退格键被点击)
|
|
94
|
+
* @event {Function} cancel 键盘顶部工具条左边的"取消"按钮被点击
|
|
95
|
+
* @event {Function} confirm 键盘顶部工具条右边的"完成"按钮被点击
|
|
96
|
+
* @event {Function} backspace 键盘退格键被点击
|
|
97
|
+
* @example <u-keyboard mode="number" v-model="show"></u-keyboard>
|
|
98
|
+
*/
|
|
99
|
+
export default {
|
|
100
|
+
name: "u-keyboard",
|
|
101
|
+
data() {
|
|
102
|
+
return {
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
mixins: [uni.$u.mpMixin, uni.$u.mixin,props],
|
|
107
|
+
methods: {
|
|
108
|
+
change(e) {
|
|
109
|
+
this.$emit('change', e);
|
|
110
|
+
},
|
|
111
|
+
// 键盘关闭
|
|
112
|
+
popupClose() {
|
|
113
|
+
this.$emit('close');
|
|
114
|
+
},
|
|
115
|
+
// 输入完成
|
|
116
|
+
onConfirm() {
|
|
117
|
+
this.$emit('confirm');
|
|
118
|
+
},
|
|
119
|
+
// 取消输入
|
|
120
|
+
onCancel() {
|
|
121
|
+
this.$emit('cancel');
|
|
122
|
+
},
|
|
123
|
+
// 退格键
|
|
124
|
+
backspace() {
|
|
125
|
+
this.$emit('backspace');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<style lang="scss" scoped>
|
|
132
|
+
@import "../../libs/css/components.scss";
|
|
133
|
+
|
|
134
|
+
.u-keyboard {
|
|
135
|
+
|
|
136
|
+
&__tooltip {
|
|
137
|
+
@include flex;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
background-color: #FFFFFF;
|
|
140
|
+
padding: 14px 12px;
|
|
141
|
+
|
|
142
|
+
&__item {
|
|
143
|
+
color: #333333;
|
|
144
|
+
flex: 1;
|
|
145
|
+
text-align: center;
|
|
146
|
+
font-size: 15px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&__submit {
|
|
150
|
+
text-align: right;
|
|
151
|
+
color: $u-primary;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&__cancel {
|
|
155
|
+
text-align: left;
|
|
156
|
+
color: #888888;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&__tips {
|
|
160
|
+
color: $u-tips-color;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
color: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: uni.$u.props.line.color
|
|
6
|
+
},
|
|
7
|
+
// 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等
|
|
8
|
+
length: {
|
|
9
|
+
type: [String, Number],
|
|
10
|
+
default: uni.$u.props.line.length
|
|
11
|
+
},
|
|
12
|
+
// 线条方向,col-竖向,row-横向
|
|
13
|
+
direction: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: uni.$u.props.line.direction
|
|
16
|
+
},
|
|
17
|
+
// 是否显示细边框
|
|
18
|
+
hairline: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: uni.$u.props.line.hairline
|
|
21
|
+
},
|
|
22
|
+
// 线条与上下左右元素的间距,字符串形式,如"30px"、"20px 30px"
|
|
23
|
+
margin: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: uni.$u.props.line.margin
|
|
26
|
+
},
|
|
27
|
+
// 是否虚线,true-虚线,false-实线
|
|
28
|
+
dashed: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: uni.$u.props.line.dashed
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|