@gmcb/uv-ui 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +295 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/components/uv-action-sheet/props.js +50 -0
- package/components/uv-action-sheet/uv-action-sheet.vue +280 -0
- package/components/uv-album/uv-album.vue +312 -0
- package/components/uv-alert/props.js +45 -0
- package/components/uv-alert/uv-alert.vue +246 -0
- package/components/uv-avatar/props.js +85 -0
- package/components/uv-avatar/uv-avatar.vue +182 -0
- package/components/uv-avatar-group/props.js +53 -0
- package/components/uv-avatar-group/uv-avatar-group.vue +106 -0
- package/components/uv-back-top/props.js +58 -0
- package/components/uv-back-top/uv-back-top.vue +116 -0
- package/components/uv-badge/props.js +73 -0
- package/components/uv-badge/uv-badge.vue +176 -0
- package/components/uv-button/nvue.scss +46 -0
- package/components/uv-button/props.js +163 -0
- package/components/uv-button/uv-button.vue +529 -0
- package/components/uv-button/vue.scss +93 -0
- package/components/uv-calendar/calendar.js +546 -0
- package/components/uv-calendar/header.vue +104 -0
- package/components/uv-calendar/month.vue +616 -0
- package/components/uv-calendar/props.js +145 -0
- package/components/uv-calendar/uv-calendar.vue +390 -0
- package/components/uv-calendars/calendar-body.vue +376 -0
- package/components/uv-calendars/calendar-item.vue +248 -0
- package/components/uv-calendars/calendar.js +546 -0
- package/components/uv-calendars/i18n/en.json +12 -0
- package/components/uv-calendars/i18n/index.js +8 -0
- package/components/uv-calendars/i18n/zh-Hans.json +12 -0
- package/components/uv-calendars/i18n/zh-Hant.json +12 -0
- package/components/uv-calendars/util.js +435 -0
- package/components/uv-calendars/uv-calendars.vue +452 -0
- package/components/uv-cell/props.js +116 -0
- package/components/uv-cell/uv-cell.vue +209 -0
- package/components/uv-cell-group/props.js +15 -0
- package/components/uv-cell-group/uv-cell-group.vue +63 -0
- package/components/uv-checkbox/props.js +70 -0
- package/components/uv-checkbox/uv-checkbox.vue +371 -0
- package/components/uv-checkbox-group/props.js +84 -0
- package/components/uv-checkbox-group/uv-checkbox-group.vue +119 -0
- package/components/uv-code/props.js +35 -0
- package/components/uv-code/uv-code.vue +136 -0
- package/components/uv-code-input/props.js +83 -0
- package/components/uv-code-input/uv-code-input.vue +272 -0
- package/components/uv-col/props.js +30 -0
- package/components/uv-col/uv-col.vue +165 -0
- package/components/uv-collapse/props.js +20 -0
- package/components/uv-collapse/uv-collapse.vue +86 -0
- package/components/uv-collapse-item/props.js +60 -0
- package/components/uv-collapse-item/uv-collapse-item.vue +228 -0
- package/components/uv-column-notice/props.js +61 -0
- package/components/uv-column-notice/uv-column-notice.vue +176 -0
- package/components/uv-count-down/props.js +25 -0
- package/components/uv-count-down/utils.js +62 -0
- package/components/uv-count-down/uv-count-down.vue +169 -0
- package/components/uv-count-to/props.js +60 -0
- package/components/uv-count-to/uv-count-to.vue +187 -0
- package/components/uv-datetime-picker/props.js +130 -0
- package/components/uv-datetime-picker/uv-datetime-picker.vue +355 -0
- package/components/uv-divider/props.js +45 -0
- package/components/uv-divider/uv-divider.vue +113 -0
- package/components/uv-drop-down/uv-drop-down.vue +135 -0
- package/components/uv-drop-down-item/uv-drop-down-item.vue +169 -0
- package/components/uv-drop-down-popup/uv-drop-down-popup.vue +242 -0
- package/components/uv-empty/props.js +60 -0
- package/components/uv-empty/uv-empty.vue +126 -0
- package/components/uv-form/props.js +46 -0
- package/components/uv-form/uv-form.vue +209 -0
- package/components/uv-form/valid.js +1343 -0
- package/components/uv-form-item/props.js +49 -0
- package/components/uv-form-item/uv-form-item.vue +226 -0
- package/components/uv-gap/props.js +25 -0
- package/components/uv-gap/uv-gap.vue +36 -0
- package/components/uv-grid/props.js +20 -0
- package/components/uv-grid/uv-grid.vue +100 -0
- package/components/uv-grid-item/props.js +15 -0
- package/components/uv-grid-item/uv-grid-item.vue +223 -0
- package/components/uv-icon/icons.js +160 -0
- package/components/uv-icon/props.js +90 -0
- package/components/uv-icon/uv-icon.vue +226 -0
- package/components/uv-icon/uvicons.ttf +0 -0
- package/components/uv-image/props.js +100 -0
- package/components/uv-image/uv-image.vue +296 -0
- package/components/uv-index-anchor/props.js +30 -0
- package/components/uv-index-anchor/uv-index-anchor.vue +98 -0
- package/components/uv-index-item/uv-index-item.vue +87 -0
- package/components/uv-index-list/props.js +30 -0
- package/components/uv-index-list/uv-index-list.vue +461 -0
- package/components/uv-input/props.js +175 -0
- package/components/uv-input/uv-input.vue +348 -0
- package/components/uv-keyboard/props.js +95 -0
- package/components/uv-keyboard/uv-keyboard.vue +180 -0
- package/components/uv-keyboard-car/props.js +24 -0
- package/components/uv-keyboard-car/uv-keyboard-car.vue +347 -0
- package/components/uv-keyboard-number/props.js +19 -0
- package/components/uv-keyboard-number/uv-keyboard-number.vue +201 -0
- package/components/uv-line/props.js +34 -0
- package/components/uv-line/uv-line.vue +60 -0
- package/components/uv-line-progress/props.js +29 -0
- package/components/uv-line-progress/uv-line-progress.vue +146 -0
- package/components/uv-link/props.js +40 -0
- package/components/uv-link/uv-link.vue +83 -0
- package/components/uv-list/uv-list.vue +147 -0
- package/components/uv-list-item/uv-list-item.vue +535 -0
- package/components/uv-load-more/props.js +95 -0
- package/components/uv-load-more/uv-load-more.vue +152 -0
- package/components/uv-loading-icon/props.js +67 -0
- package/components/uv-loading-icon/uv-loading-icon.vue +347 -0
- package/components/uv-loading-page/props.js +55 -0
- package/components/uv-loading-page/uv-loading-page.vue +96 -0
- package/components/uv-modal/props.js +90 -0
- package/components/uv-modal/uv-modal.vue +245 -0
- package/components/uv-navbar/props.js +89 -0
- package/components/uv-navbar/uv-navbar.vue +245 -0
- package/components/uv-no-network/props.js +20 -0
- package/components/uv-no-network/uv-no-network.vue +222 -0
- package/components/uv-notice-bar/props.js +76 -0
- package/components/uv-notice-bar/uv-notice-bar.vue +110 -0
- package/components/uv-notify/props.js +45 -0
- package/components/uv-notify/uv-notify.vue +220 -0
- package/components/uv-number-box/props.js +118 -0
- package/components/uv-number-box/uv-number-box.vue +397 -0
- package/components/uv-overlay/props.js +25 -0
- package/components/uv-overlay/uv-overlay.vue +85 -0
- package/components/uv-parse/node/node.vue +576 -0
- package/components/uv-parse/parser.js +1335 -0
- package/components/uv-parse/uv-parse.vue +498 -0
- package/components/uv-pick-color/colors.js +217 -0
- package/components/uv-pick-color/props.js +47 -0
- package/components/uv-pick-color/uv-pick-color.vue +551 -0
- package/components/uv-picker/props.js +95 -0
- package/components/uv-picker/uv-picker.vue +329 -0
- package/components/uv-popup/keypress.js +45 -0
- package/components/uv-popup/uv-popup.vue +537 -0
- package/components/uv-preview-video/uv-preview-video.vue +52 -0
- package/components/uv-qrcode/cache.js +1 -0
- package/components/uv-qrcode/gcanvas/bridge/bridge-weex.js +241 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js +18 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStylePattern.js +8 -0
- package/components/uv-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js +17 -0
- package/components/uv-qrcode/gcanvas/context-2d/RenderingContext.js +666 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ActiveInfo.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Buffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Framebuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLenum.js +298 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLmethod.js +142 -0
- package/components/uv-qrcode/gcanvas/context-webgl/GLtype.js +23 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Program.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Renderbuffer.js +21 -0
- package/components/uv-qrcode/gcanvas/context-webgl/RenderingContext.js +1191 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Shader.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js +11 -0
- package/components/uv-qrcode/gcanvas/context-webgl/Texture.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/UniformLocation.js +22 -0
- package/components/uv-qrcode/gcanvas/context-webgl/classUtils.js +3 -0
- package/components/uv-qrcode/gcanvas/env/canvas.js +74 -0
- package/components/uv-qrcode/gcanvas/env/image.js +96 -0
- package/components/uv-qrcode/gcanvas/env/tool.js +24 -0
- package/components/uv-qrcode/gcanvas/index.js +39 -0
- package/components/uv-qrcode/props.js +85 -0
- package/components/uv-qrcode/qrcode.js +34 -0
- package/components/uv-qrcode/queue.js +41 -0
- package/components/uv-qrcode/uv-qrcode.vue +1038 -0
- package/components/uv-radio/props.js +65 -0
- package/components/uv-radio/uv-radio.vue +349 -0
- package/components/uv-radio-group/props.js +89 -0
- package/components/uv-radio-group/uv-radio-group.vue +115 -0
- package/components/uv-rate/props.js +73 -0
- package/components/uv-rate/uv-rate.vue +274 -0
- package/components/uv-read-more/props.js +62 -0
- package/components/uv-read-more/uv-read-more.vue +162 -0
- package/components/uv-row/props.js +20 -0
- package/components/uv-row/uv-row.vue +95 -0
- package/components/uv-row-notice/props.js +40 -0
- package/components/uv-row-notice/uv-row-notice.vue +341 -0
- package/components/uv-safe-bottom/uv-safe-bottom.vue +67 -0
- package/components/uv-scroll-list/nvue.js +29 -0
- package/components/uv-scroll-list/props.js +35 -0
- package/components/uv-scroll-list/scrollWxs.wxs +51 -0
- package/components/uv-scroll-list/uv-scroll-list.vue +218 -0
- package/components/uv-search/props.js +127 -0
- package/components/uv-search/uv-search.vue +311 -0
- package/components/uv-skeleton/props.js +65 -0
- package/components/uv-skeleton/uv-skeleton.vue +250 -0
- package/components/uv-skeletons/uv-skeletons.vue +247 -0
- package/components/uv-slider/props.js +58 -0
- package/components/uv-slider/uv-slider.vue +58 -0
- package/components/uv-status-bar/props.js +8 -0
- package/components/uv-status-bar/uv-status-bar.vue +54 -0
- package/components/uv-steps/props.js +40 -0
- package/components/uv-steps/uv-steps.vue +83 -0
- package/components/uv-steps-item/props.js +25 -0
- package/components/uv-steps-item/uv-steps-item.vue +347 -0
- package/components/uv-sticky/props.js +41 -0
- package/components/uv-sticky/uv-sticky.vue +223 -0
- package/components/uv-subsection/props.js +54 -0
- package/components/uv-subsection/uv-subsection.vue +269 -0
- package/components/uv-swipe-action/props.js +10 -0
- package/components/uv-swipe-action/uv-swipe-action.vue +65 -0
- package/components/uv-swipe-action-item/index - backup.wxs +256 -0
- package/components/uv-swipe-action-item/index.wxs +225 -0
- package/components/uv-swipe-action-item/nvue - backup.js +264 -0
- package/components/uv-swipe-action-item/nvue.js +182 -0
- package/components/uv-swipe-action-item/props.js +40 -0
- package/components/uv-swipe-action-item/uv-swipe-action-item.vue +200 -0
- package/components/uv-swipe-action-item/wxs.js +15 -0
- package/components/uv-swiper/props.js +136 -0
- package/components/uv-swiper/uv-swiper.vue +263 -0
- package/components/uv-swiper-indicator/props.js +30 -0
- package/components/uv-swiper-indicator/uv-swiper-indicator.vue +112 -0
- package/components/uv-switch/props.js +58 -0
- package/components/uv-switch/uv-switch.vue +182 -0
- package/components/uv-tabbar/props.js +50 -0
- package/components/uv-tabbar/uv-tabbar.vue +146 -0
- package/components/uv-tabbar-item/props.js +40 -0
- package/components/uv-tabbar-item/uv-tabbar-item.vue +146 -0
- package/components/uv-tabs/props.js +71 -0
- package/components/uv-tabs/uv-tabs.vue +391 -0
- package/components/uv-tags/props.js +104 -0
- package/components/uv-tags/uv-tags.vue +379 -0
- package/components/uv-text/props.js +113 -0
- package/components/uv-text/uv-text.vue +218 -0
- package/components/uv-text/value.js +87 -0
- package/components/uv-textarea/props.js +138 -0
- package/components/uv-textarea/uv-textarea.vue +238 -0
- package/components/uv-toast/uv-toast.vue +292 -0
- package/components/uv-toolbar/props.js +40 -0
- package/components/uv-toolbar/uv-toolbar.vue +109 -0
- package/components/uv-tooltip/props.js +60 -0
- package/components/uv-tooltip/uv-tooltip.vue +372 -0
- package/components/uv-transition/createAnimation.js +131 -0
- package/components/uv-transition/props.js +31 -0
- package/components/uv-transition/uv-transition.vue +320 -0
- package/components/uv-upload/mixin.js +22 -0
- package/components/uv-upload/props.js +130 -0
- package/components/uv-upload/utils.js +151 -0
- package/components/uv-upload/uv-upload.vue +488 -0
- package/components/uv-vtabs/props.js +79 -0
- package/components/uv-vtabs/uv-vtabs.vue +438 -0
- package/components/uv-vtabs-item/uv-vtabs-item.vue +68 -0
- package/components/uv-waterfall/props.js +69 -0
- package/components/uv-waterfall/uv-waterfall.vue +265 -0
- package/index.js +82 -0
- package/index.scss +7 -0
- package/libs/config/config.js +34 -0
- package/libs/css/color.scss +32 -0
- package/libs/css/common.scss +100 -0
- package/libs/css/components.scss +23 -0
- package/libs/css/variable.scss +111 -0
- package/libs/css/vue.scss +40 -0
- package/libs/function/colorGradient.js +134 -0
- package/libs/function/compress.js +27 -0
- package/libs/function/debounce.js +29 -0
- package/libs/function/digit.js +167 -0
- package/libs/function/index.js +734 -0
- package/libs/function/platform.js +75 -0
- package/libs/function/test.js +287 -0
- package/libs/function/throttle.js +30 -0
- package/libs/luch-request/adapters/index.js +132 -0
- package/libs/luch-request/core/InterceptorManager.js +51 -0
- package/libs/luch-request/core/Request.js +201 -0
- package/libs/luch-request/core/buildFullPath.js +20 -0
- package/libs/luch-request/core/defaults.js +33 -0
- package/libs/luch-request/core/dispatchRequest.js +6 -0
- package/libs/luch-request/core/mergeConfig.js +126 -0
- package/libs/luch-request/core/settle.js +16 -0
- package/libs/luch-request/helpers/buildURL.js +64 -0
- package/libs/luch-request/helpers/combineURLs.js +14 -0
- package/libs/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/libs/luch-request/index.d.ts +197 -0
- package/libs/luch-request/index.js +2 -0
- package/libs/luch-request/utils/clone.js +264 -0
- package/libs/luch-request/utils.js +135 -0
- package/libs/mixin/button.js +13 -0
- package/libs/mixin/mixin.js +172 -0
- package/libs/mixin/mpMixin.js +8 -0
- package/libs/mixin/mpShare.js +13 -0
- package/libs/mixin/openType.js +47 -0
- package/libs/mixin/touch.js +59 -0
- package/libs/util/dayjs.js +216 -0
- package/libs/util/route.js +126 -0
- package/package.json +28 -0
- package/theme.scss +43 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-keyboard"
|
|
4
|
+
@touchmove.stop.prevent="noop"
|
|
5
|
+
>
|
|
6
|
+
<view
|
|
7
|
+
v-for="(group, i) in abc ? engKeyBoardList : areaList"
|
|
8
|
+
:key="i"
|
|
9
|
+
class="uv-keyboard__button"
|
|
10
|
+
:index="i"
|
|
11
|
+
:class="[i + 1 === 4 && 'uv-keyboard__button--center']"
|
|
12
|
+
>
|
|
13
|
+
<view
|
|
14
|
+
v-if="i === 3"
|
|
15
|
+
class="uv-keyboard__button__inner-wrapper"
|
|
16
|
+
>
|
|
17
|
+
<view
|
|
18
|
+
class="uv-keyboard__button__inner-wrapper__left"
|
|
19
|
+
hover-class="uv-hover-class"
|
|
20
|
+
:hover-stay-time="200"
|
|
21
|
+
@tap="changeCarInputMode"
|
|
22
|
+
>
|
|
23
|
+
<slot>
|
|
24
|
+
<template v-if="!customabc">
|
|
25
|
+
<text
|
|
26
|
+
class="uv-keyboard__button__inner-wrapper__left__lang"
|
|
27
|
+
:class="[!abc && 'uv-keyboard__button__inner-wrapper__left__lang--active']"
|
|
28
|
+
>中</text>
|
|
29
|
+
<text class="uv-keyboard__button__inner-wrapper__left__line">/</text>
|
|
30
|
+
<text
|
|
31
|
+
class="uv-keyboard__button__inner-wrapper__left__lang"
|
|
32
|
+
:class="[abc && 'uv-keyboard__button__inner-wrapper__left__lang--active']"
|
|
33
|
+
>英</text>
|
|
34
|
+
</template>
|
|
35
|
+
</slot>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
<view
|
|
39
|
+
class="uv-keyboard__button__inner-wrapper"
|
|
40
|
+
v-for="(item, j) in group"
|
|
41
|
+
:key="j"
|
|
42
|
+
>
|
|
43
|
+
<view
|
|
44
|
+
:class="['uv-keyboard__button__inner-wrapper__inner',{'uv-keyboard__button__inner-wrapper__inner--disabled': isDisabled(i,j)}]"
|
|
45
|
+
:hover-stay-time="200"
|
|
46
|
+
@tap="carInputClick(i, j)"
|
|
47
|
+
:hover-class="isDisabled(i,j)?'none':'uv-hover-class'"
|
|
48
|
+
>
|
|
49
|
+
<text class="uv-keyboard__button__inner-wrapper__inner__text">{{ item }}</text>
|
|
50
|
+
</view>
|
|
51
|
+
<view class="uv-keyboard__button__inner-wrapper__disabled--mask" v-if="isDisabled(i,j)"></view>
|
|
52
|
+
</view>
|
|
53
|
+
<view
|
|
54
|
+
v-if="i === 3"
|
|
55
|
+
@touchstart="backspaceClick"
|
|
56
|
+
@touchend="clearTimer"
|
|
57
|
+
class="uv-keyboard__button__inner-wrapper"
|
|
58
|
+
>
|
|
59
|
+
<view
|
|
60
|
+
class="uv-keyboard__button__inner-wrapper__right"
|
|
61
|
+
hover-class="uv-hover-class"
|
|
62
|
+
:hover-stay-time="200"
|
|
63
|
+
>
|
|
64
|
+
<uv-icon
|
|
65
|
+
size="28"
|
|
66
|
+
name="backspace"
|
|
67
|
+
color="#303133"
|
|
68
|
+
></uv-icon>
|
|
69
|
+
</view>
|
|
70
|
+
</view>
|
|
71
|
+
</view>
|
|
72
|
+
</view>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<script>
|
|
76
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
77
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
78
|
+
import props from './props.js';
|
|
79
|
+
/**
|
|
80
|
+
* keyboard 键盘组件
|
|
81
|
+
* @description 此为uvui自定义的键盘面板,内含了数字键盘,车牌号键,身份证号键盘3种模式,都有可以打乱按键顺序的选项。
|
|
82
|
+
* @tutorial https://www.uvui.cn/components/keyboard.html
|
|
83
|
+
* @property {Boolean} random 是否打乱键盘的顺序
|
|
84
|
+
* @event {Function} change 点击键盘触发
|
|
85
|
+
* @event {Function} backspace 点击退格键触发
|
|
86
|
+
* @example <uv-keyboard ref="uKeyboard" mode="car" v-model="show"></uv-keyboard>
|
|
87
|
+
*/
|
|
88
|
+
export default {
|
|
89
|
+
name: "uv-keyboard",
|
|
90
|
+
mixins: [mpMixin, mixin, props],
|
|
91
|
+
emits: ['backspace','change','changeCarInputMode'],
|
|
92
|
+
data() {
|
|
93
|
+
return {
|
|
94
|
+
// 车牌输入时,abc=true为输入车牌号码,bac=false为输入省份中文简称
|
|
95
|
+
abc: false
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
areaList() {
|
|
100
|
+
let data = [
|
|
101
|
+
'京',
|
|
102
|
+
'沪',
|
|
103
|
+
'粤',
|
|
104
|
+
'津',
|
|
105
|
+
'冀',
|
|
106
|
+
'豫',
|
|
107
|
+
'云',
|
|
108
|
+
'辽',
|
|
109
|
+
'黑',
|
|
110
|
+
'湘',
|
|
111
|
+
'皖',
|
|
112
|
+
'鲁',
|
|
113
|
+
'苏',
|
|
114
|
+
'浙',
|
|
115
|
+
'赣',
|
|
116
|
+
'鄂',
|
|
117
|
+
'桂',
|
|
118
|
+
'甘',
|
|
119
|
+
'晋',
|
|
120
|
+
'陕',
|
|
121
|
+
'蒙',
|
|
122
|
+
'吉',
|
|
123
|
+
'闽',
|
|
124
|
+
'贵',
|
|
125
|
+
'渝',
|
|
126
|
+
'川',
|
|
127
|
+
'青',
|
|
128
|
+
'琼',
|
|
129
|
+
'宁',
|
|
130
|
+
'挂',
|
|
131
|
+
'藏',
|
|
132
|
+
'港',
|
|
133
|
+
'澳',
|
|
134
|
+
'新',
|
|
135
|
+
'使',
|
|
136
|
+
'学'
|
|
137
|
+
];
|
|
138
|
+
let tmp = [];
|
|
139
|
+
// 打乱顺序
|
|
140
|
+
if (this.random) data = this.$uv.randomArray(data);
|
|
141
|
+
// 切割成二维数组
|
|
142
|
+
tmp[0] = data.slice(0, 10);
|
|
143
|
+
tmp[1] = data.slice(10, 20);
|
|
144
|
+
tmp[2] = data.slice(20, 30);
|
|
145
|
+
tmp[3] = data.slice(30, 36);
|
|
146
|
+
return tmp;
|
|
147
|
+
},
|
|
148
|
+
engKeyBoardList() {
|
|
149
|
+
let data = [
|
|
150
|
+
1,
|
|
151
|
+
2,
|
|
152
|
+
3,
|
|
153
|
+
4,
|
|
154
|
+
5,
|
|
155
|
+
6,
|
|
156
|
+
7,
|
|
157
|
+
8,
|
|
158
|
+
9,
|
|
159
|
+
0,
|
|
160
|
+
'Q',
|
|
161
|
+
'W',
|
|
162
|
+
'E',
|
|
163
|
+
'R',
|
|
164
|
+
'T',
|
|
165
|
+
'Y',
|
|
166
|
+
'U',
|
|
167
|
+
'I',
|
|
168
|
+
'O',
|
|
169
|
+
'P',
|
|
170
|
+
'A',
|
|
171
|
+
'S',
|
|
172
|
+
'D',
|
|
173
|
+
'F',
|
|
174
|
+
'G',
|
|
175
|
+
'H',
|
|
176
|
+
'J',
|
|
177
|
+
'K',
|
|
178
|
+
'L',
|
|
179
|
+
'Z',
|
|
180
|
+
'X',
|
|
181
|
+
'C',
|
|
182
|
+
'V',
|
|
183
|
+
'B',
|
|
184
|
+
'N',
|
|
185
|
+
'M'
|
|
186
|
+
];
|
|
187
|
+
let tmp = [];
|
|
188
|
+
if (this.random) data = this.$uv.randomArray(data);
|
|
189
|
+
tmp[0] = data.slice(0, 10);
|
|
190
|
+
tmp[1] = data.slice(10, 20);
|
|
191
|
+
tmp[2] = data.slice(20, 30);
|
|
192
|
+
tmp[3] = data.slice(30, 36);
|
|
193
|
+
return tmp;
|
|
194
|
+
},
|
|
195
|
+
isDisabled(i,j) {
|
|
196
|
+
return (i,j)=>{
|
|
197
|
+
let value = '';
|
|
198
|
+
if (this.abc) value = this.engKeyBoardList[i][j];
|
|
199
|
+
else value = this.areaList[i][j];
|
|
200
|
+
return this.disKeys.indexOf(value) > -1;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
methods: {
|
|
205
|
+
// 点击键盘按钮
|
|
206
|
+
carInputClick(i, j) {
|
|
207
|
+
if(this.isDisabled(i,j)) return;
|
|
208
|
+
let value = '';
|
|
209
|
+
// 不同模式,获取不同数组的值
|
|
210
|
+
if (this.abc) value = this.engKeyBoardList[i][j];
|
|
211
|
+
else value = this.areaList[i][j];
|
|
212
|
+
// 如果允许自动切换,则将中文状态切换为英文
|
|
213
|
+
if (!this.abc && this.autoChange) this.$uv.sleep(200).then(() => this.abc = true)
|
|
214
|
+
this.$emit('change', value);
|
|
215
|
+
},
|
|
216
|
+
// 修改汽车牌键盘的输入模式,中文|英文
|
|
217
|
+
changeCarInputMode() {
|
|
218
|
+
this.abc = !this.abc;
|
|
219
|
+
this.$emit('changeCarInputMode',this.abc);
|
|
220
|
+
},
|
|
221
|
+
// 点击退格键
|
|
222
|
+
backspaceClick() {
|
|
223
|
+
this.$emit('backspace');
|
|
224
|
+
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
|
|
225
|
+
this.timer = null;
|
|
226
|
+
this.timer = setInterval(() => {
|
|
227
|
+
this.$emit('backspace');
|
|
228
|
+
}, 250);
|
|
229
|
+
},
|
|
230
|
+
clearTimer() {
|
|
231
|
+
clearInterval(this.timer);
|
|
232
|
+
this.timer = null;
|
|
233
|
+
},
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
</script>
|
|
237
|
+
|
|
238
|
+
<style lang="scss" scoped>
|
|
239
|
+
$show-hover: 1;
|
|
240
|
+
@import '../../libs/css/variable.scss';
|
|
241
|
+
@import '../../libs/css/components.scss';
|
|
242
|
+
@import '../../libs/css/color.scss';
|
|
243
|
+
$uv-car-keyboard-background-color: rgb(224, 228, 230) !default;
|
|
244
|
+
$uv-car-keyboard-padding:6px 0 6px !default;
|
|
245
|
+
$uv-car-keyboard-button-inner-width:64rpx !default;
|
|
246
|
+
$uv-car-keyboard-button-inner-background-color:#FFFFFF !default;
|
|
247
|
+
$uv-car-keyboard-button-height:80rpx !default;
|
|
248
|
+
$uv-car-keyboard-button-inner-box-shadow:0 1px 0px #999992 !default;
|
|
249
|
+
$uv-car-keyboard-button-border-radius:4px !default;
|
|
250
|
+
$uv-car-keyboard-button-inner-margin:8rpx 5rpx !default;
|
|
251
|
+
$uv-car-keyboard-button-text-font-size:16px !default;
|
|
252
|
+
$uv-car-keyboard-button-text-color:$uv-main-color !default;
|
|
253
|
+
$uv-car-keyboard-center-inner-margin: 0 4rpx !default;
|
|
254
|
+
$uv-car-keyboard-special-button-width:134rpx !default;
|
|
255
|
+
$uv-car-keyboard-lang-font-size:16px !default;
|
|
256
|
+
$uv-car-keyboard-lang-color:$uv-main-color !default;
|
|
257
|
+
$uv-car-keyboard-active-color:$uv-primary !default;
|
|
258
|
+
$uv-car-keyboard-line-font-size:15px !default;
|
|
259
|
+
$uv-car-keyboard-line-color:$uv-main-color !default;
|
|
260
|
+
$uv-car-keyboard-line-margin:0 1px !default;
|
|
261
|
+
$uv-car-keyboard-uv-hover-class-background-color:#BBBCC6 !default;
|
|
262
|
+
|
|
263
|
+
.uv-keyboard {
|
|
264
|
+
@include flex(column);
|
|
265
|
+
justify-content: space-around;
|
|
266
|
+
background-color: $uv-car-keyboard-background-color;
|
|
267
|
+
align-items: stretch;
|
|
268
|
+
padding: $uv-car-keyboard-padding;
|
|
269
|
+
|
|
270
|
+
&__button {
|
|
271
|
+
@include flex;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
flex: 1;
|
|
274
|
+
/* #ifndef APP-NVUE */
|
|
275
|
+
/* #endif */
|
|
276
|
+
|
|
277
|
+
&__inner-wrapper {
|
|
278
|
+
position: relative;
|
|
279
|
+
box-shadow: $uv-car-keyboard-button-inner-box-shadow;
|
|
280
|
+
margin: $uv-car-keyboard-button-inner-margin;
|
|
281
|
+
border-radius: $uv-car-keyboard-button-border-radius;
|
|
282
|
+
|
|
283
|
+
&__disabled--mask {
|
|
284
|
+
position: absolute;
|
|
285
|
+
left: 0;
|
|
286
|
+
top: 0;
|
|
287
|
+
bottom: 0;
|
|
288
|
+
right: 0;
|
|
289
|
+
width: $uv-car-keyboard-button-inner-width;
|
|
290
|
+
height: $uv-car-keyboard-button-height;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&__inner {
|
|
294
|
+
@include flex;
|
|
295
|
+
justify-content: center;
|
|
296
|
+
align-items: center;
|
|
297
|
+
width: $uv-car-keyboard-button-inner-width;
|
|
298
|
+
background-color: $uv-car-keyboard-button-inner-background-color;
|
|
299
|
+
height: $uv-car-keyboard-button-height;
|
|
300
|
+
border-radius: $uv-car-keyboard-button-border-radius;
|
|
301
|
+
|
|
302
|
+
&--disabled {
|
|
303
|
+
opacity: 0.5;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&__text {
|
|
307
|
+
font-size: $uv-car-keyboard-button-text-font-size;
|
|
308
|
+
color: $uv-car-keyboard-button-text-color;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
&__left,
|
|
313
|
+
&__right {
|
|
314
|
+
border-radius: $uv-car-keyboard-button-border-radius;
|
|
315
|
+
width: $uv-car-keyboard-special-button-width;
|
|
316
|
+
height: $uv-car-keyboard-button-height;
|
|
317
|
+
background-color: $uv-car-keyboard-uv-hover-class-background-color;
|
|
318
|
+
@include flex;
|
|
319
|
+
justify-content: center;
|
|
320
|
+
align-items: center;
|
|
321
|
+
box-shadow: $uv-car-keyboard-button-inner-box-shadow;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
&__left {
|
|
325
|
+
&__line {
|
|
326
|
+
font-size: $uv-car-keyboard-line-font-size;
|
|
327
|
+
color: $uv-car-keyboard-line-color;
|
|
328
|
+
margin: $uv-car-keyboard-line-margin;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
&__lang {
|
|
332
|
+
font-size: $uv-car-keyboard-lang-font-size;
|
|
333
|
+
color: $uv-car-keyboard-lang-color;
|
|
334
|
+
|
|
335
|
+
&--active {
|
|
336
|
+
color: $uv-car-keyboard-active-color;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.uv-hover-class {
|
|
345
|
+
background-color: $uv-car-keyboard-uv-hover-class-background-color;
|
|
346
|
+
}
|
|
347
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 键盘的类型,number-数字键盘,card-身份证键盘
|
|
4
|
+
mode: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: 'number'
|
|
7
|
+
},
|
|
8
|
+
// 是否显示键盘的"."符号
|
|
9
|
+
dotDisabled: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false
|
|
12
|
+
},
|
|
13
|
+
// 是否打乱键盘按键的顺序
|
|
14
|
+
random: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-keyboard"
|
|
4
|
+
@touchmove.stop.prevent="noop"
|
|
5
|
+
>
|
|
6
|
+
<view
|
|
7
|
+
class="uv-keyboard__button-wrapper"
|
|
8
|
+
v-for="(item, index) in numList"
|
|
9
|
+
:key="index"
|
|
10
|
+
>
|
|
11
|
+
<view
|
|
12
|
+
class="uv-keyboard__button-wrapper__button"
|
|
13
|
+
:style="[itemStyle(index)]"
|
|
14
|
+
@tap="keyboardClick(item)"
|
|
15
|
+
hover-class="uv-hover-class"
|
|
16
|
+
:hover-stay-time="200"
|
|
17
|
+
>
|
|
18
|
+
<text class="uv-keyboard__button-wrapper__button__text">{{ item }}</text>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
<view
|
|
22
|
+
class="uv-keyboard__button-wrapper"
|
|
23
|
+
>
|
|
24
|
+
<view
|
|
25
|
+
class="uv-keyboard__button-wrapper__button uv-keyboard__button-wrapper__button--gray"
|
|
26
|
+
hover-class="uv-hover-class"
|
|
27
|
+
:hover-stay-time="200"
|
|
28
|
+
@touchstart.stop="backspaceClick"
|
|
29
|
+
@touchend="clearTimer"
|
|
30
|
+
>
|
|
31
|
+
<uv-icon
|
|
32
|
+
name="backspace"
|
|
33
|
+
color="#303133"
|
|
34
|
+
size="28"
|
|
35
|
+
></uv-icon>
|
|
36
|
+
</view>
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
43
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
44
|
+
import props from './props.js';
|
|
45
|
+
/**
|
|
46
|
+
* keyboard 键盘组件
|
|
47
|
+
* @description
|
|
48
|
+
* @tutorial
|
|
49
|
+
* @property {String} mode 键盘的类型,number-数字键盘,card-身份证键盘
|
|
50
|
+
* @property {Boolean} dotDisabled 是否显示键盘的"."符号
|
|
51
|
+
* @property {Boolean} random 是否打乱键盘按键的顺序
|
|
52
|
+
* @event {Function} change 点击键盘触发
|
|
53
|
+
* @event {Function} backspace 点击退格键触发
|
|
54
|
+
* @example
|
|
55
|
+
*/
|
|
56
|
+
export default {
|
|
57
|
+
mixins: [mpMixin, mixin, props],
|
|
58
|
+
emits: ['backspace','change'],
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
backspace: 'backspace', // 退格键内容
|
|
62
|
+
dot: '.', // 点
|
|
63
|
+
timer: null, // 长按多次删除的事件监听
|
|
64
|
+
cardX: 'X' // 身份证的X符号
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
// 键盘需要显示的内容
|
|
69
|
+
numList() {
|
|
70
|
+
let tmp = [];
|
|
71
|
+
if (this.dotDisabled && this.mode == 'number') {
|
|
72
|
+
if (!this.random) {
|
|
73
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
|
74
|
+
} else {
|
|
75
|
+
return this.$uv.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
|
76
|
+
}
|
|
77
|
+
} else if (!this.dotDisabled && this.mode == 'number') {
|
|
78
|
+
if (!this.random) {
|
|
79
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
|
|
80
|
+
} else {
|
|
81
|
+
return this.$uv.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
|
|
82
|
+
}
|
|
83
|
+
} else if (this.mode == 'card') {
|
|
84
|
+
if (!this.random) {
|
|
85
|
+
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
|
|
86
|
+
} else {
|
|
87
|
+
return this.$uv.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
// 按键的样式,在非乱序&&数字键盘&&不显示点按钮时,index为9时,按键占位两个空间
|
|
92
|
+
itemStyle() {
|
|
93
|
+
return index => {
|
|
94
|
+
let style = {};
|
|
95
|
+
if (this.mode == 'number' && this.dotDisabled && index == 9) style.width = '464rpx';
|
|
96
|
+
return style;
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
// 是否让按键显示灰色,只在非乱序&&数字键盘&&且允许点按键的时候
|
|
100
|
+
btnBgGray() {
|
|
101
|
+
return index => {
|
|
102
|
+
if (!this.random && index == 9 && (this.mode != 'number' || (this.mode == 'number' && !this
|
|
103
|
+
.dotDisabled))) return true;
|
|
104
|
+
else return false;
|
|
105
|
+
};
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
created() {
|
|
109
|
+
|
|
110
|
+
},
|
|
111
|
+
methods: {
|
|
112
|
+
// 点击退格键
|
|
113
|
+
backspaceClick() {
|
|
114
|
+
this.$emit('backspace');
|
|
115
|
+
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
|
|
116
|
+
this.timer = null;
|
|
117
|
+
this.timer = setInterval(() => {
|
|
118
|
+
this.$emit('backspace');
|
|
119
|
+
}, 250);
|
|
120
|
+
},
|
|
121
|
+
clearTimer() {
|
|
122
|
+
clearInterval(this.timer);
|
|
123
|
+
this.timer = null;
|
|
124
|
+
},
|
|
125
|
+
// 获取键盘显示的内容
|
|
126
|
+
keyboardClick(val) {
|
|
127
|
+
// 允许键盘显示点模式和触发非点按键时,将内容转为数字类型
|
|
128
|
+
if (!this.dotDisabled && val != this.dot && val != this.cardX) val = Number(val);
|
|
129
|
+
this.$emit('change', val);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
</script>
|
|
134
|
+
|
|
135
|
+
<style lang="scss" scoped>
|
|
136
|
+
$show-hover: 1;
|
|
137
|
+
@import '../../libs/css/variable.scss';
|
|
138
|
+
@import '../../libs/css/components.scss';
|
|
139
|
+
@import '../../libs/css/color.scss';
|
|
140
|
+
$uv-number-keyboard-background-color:rgb(224, 228, 230) !default;
|
|
141
|
+
$uv-number-keyboard-padding:8px 10rpx 8px 10rpx !default;
|
|
142
|
+
$uv-number-keyboard-button-width:222rpx !default;
|
|
143
|
+
$uv-number-keyboard-button-margin:4px 6rpx !default;
|
|
144
|
+
$uv-number-keyboard-button-border-top-left-radius:4px !default;
|
|
145
|
+
$uv-number-keyboard-button-border-top-right-radius:4px !default;
|
|
146
|
+
$uv-number-keyboard-button-border-bottom-left-radius:4px !default;
|
|
147
|
+
$uv-number-keyboard-button-border-bottom-right-radius:4px !default;
|
|
148
|
+
$uv-number-keyboard-button-height: 90rpx!default;
|
|
149
|
+
$uv-number-keyboard-button-background-color:#FFFFFF !default;
|
|
150
|
+
$uv-number-keyboard-button-box-shadow:0 2px 0px #BBBCBE !default;
|
|
151
|
+
$uv-number-keyboard-text-font-size:20px !default;
|
|
152
|
+
$uv-number-keyboard-text-font-weight:500 !default;
|
|
153
|
+
$uv-number-keyboard-text-color:$uv-main-color !default;
|
|
154
|
+
$uv-number-keyboard-gray-background-color:rgb(200, 202, 210) !default;
|
|
155
|
+
$uv-number-keyboard-uv-hover-class-background-color: #BBBCC6 !default;
|
|
156
|
+
|
|
157
|
+
.uv-keyboard {
|
|
158
|
+
@include flex;
|
|
159
|
+
flex-direction: row;
|
|
160
|
+
justify-content: space-around;
|
|
161
|
+
background-color: $uv-number-keyboard-background-color;
|
|
162
|
+
flex-wrap: wrap;
|
|
163
|
+
padding: $uv-number-keyboard-padding;
|
|
164
|
+
|
|
165
|
+
&__button-wrapper {
|
|
166
|
+
box-shadow: $uv-number-keyboard-button-box-shadow;
|
|
167
|
+
margin: $uv-number-keyboard-button-margin;
|
|
168
|
+
border-top-left-radius: $uv-number-keyboard-button-border-top-left-radius;
|
|
169
|
+
border-top-right-radius: $uv-number-keyboard-button-border-top-right-radius;
|
|
170
|
+
border-bottom-left-radius: $uv-number-keyboard-button-border-bottom-left-radius;
|
|
171
|
+
border-bottom-right-radius: $uv-number-keyboard-button-border-bottom-right-radius;
|
|
172
|
+
|
|
173
|
+
&__button {
|
|
174
|
+
width: $uv-number-keyboard-button-width;
|
|
175
|
+
height: $uv-number-keyboard-button-height;
|
|
176
|
+
background-color: $uv-number-keyboard-button-background-color;
|
|
177
|
+
@include flex;
|
|
178
|
+
justify-content: center;
|
|
179
|
+
align-items: center;
|
|
180
|
+
border-top-left-radius: $uv-number-keyboard-button-border-top-left-radius;
|
|
181
|
+
border-top-right-radius: $uv-number-keyboard-button-border-top-right-radius;
|
|
182
|
+
border-bottom-left-radius: $uv-number-keyboard-button-border-bottom-left-radius;
|
|
183
|
+
border-bottom-right-radius: $uv-number-keyboard-button-border-bottom-right-radius;
|
|
184
|
+
|
|
185
|
+
&__text {
|
|
186
|
+
font-size: $uv-number-keyboard-text-font-size;
|
|
187
|
+
font-weight: $uv-number-keyboard-text-font-weight;
|
|
188
|
+
color: $uv-number-keyboard-text-color;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&--gray {
|
|
192
|
+
background-color: $uv-number-keyboard-gray-background-color;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.uv-hover-class {
|
|
199
|
+
background-color: $uv-number-keyboard-uv-hover-class-background-color;
|
|
200
|
+
}
|
|
201
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
color: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: '#d6d7d9'
|
|
6
|
+
},
|
|
7
|
+
// 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等
|
|
8
|
+
length: {
|
|
9
|
+
type: [String, Number],
|
|
10
|
+
default: '100%'
|
|
11
|
+
},
|
|
12
|
+
// 线条方向,col-竖向,row-横向
|
|
13
|
+
direction: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'row'
|
|
16
|
+
},
|
|
17
|
+
// 是否显示细边框
|
|
18
|
+
hairline: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
// 线条与上下左右元素的间距,字符串形式,如"30px"、"20px 30px"
|
|
23
|
+
margin: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: 0
|
|
26
|
+
},
|
|
27
|
+
// 是否虚线,true-虚线,false-实线
|
|
28
|
+
dashed: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
...uni.$uv?.props?.line
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="uv-line"
|
|
4
|
+
:style="[lineStyle]"
|
|
5
|
+
>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
11
|
+
import mixin from '../../libs/mixin/mixin.js'
|
|
12
|
+
import props from './props.js';
|
|
13
|
+
/**
|
|
14
|
+
* line 线条
|
|
15
|
+
* @description 此组件一般用于显示一根线条,用于分隔内容块,有横向和竖向两种模式,且能设置0.5px线条,使用也很简单
|
|
16
|
+
* @tutorial https://www.uvui.cn/components/line.html
|
|
17
|
+
* @property {String} color 线条的颜色 ( 默认 '#d6d7d9' )
|
|
18
|
+
* @property {String | Number} length 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等 ( 默认 '100%' )
|
|
19
|
+
* @property {String} direction 线条的方向,row-横向,col-竖向 (默认 'row' )
|
|
20
|
+
* @property {Boolean} hairline 是否显示细线条 (默认 true )
|
|
21
|
+
* @property {String | Number} margin 线条与上下左右元素的间距,字符串形式,如"30px" (默认 0 )
|
|
22
|
+
* @property {Boolean} dashed 是否虚线,true-虚线,false-实线 (默认 false )
|
|
23
|
+
* @property {Object} customStyle 定义需要用到的外部样式
|
|
24
|
+
* @example <uv-line color="red"></uv-line>
|
|
25
|
+
*/
|
|
26
|
+
export default {
|
|
27
|
+
name: 'uv-line',
|
|
28
|
+
mixins: [mpMixin, mixin, props],
|
|
29
|
+
computed: {
|
|
30
|
+
lineStyle() {
|
|
31
|
+
const style = {}
|
|
32
|
+
style.margin = this.margin
|
|
33
|
+
// 如果是水平线条,边框高度为1px,再通过transform缩小一半,就是0.5px了
|
|
34
|
+
if (this.direction === 'row') {
|
|
35
|
+
// 此处采用兼容分开写,兼容nvue的写法
|
|
36
|
+
style.borderBottomWidth = '1px'
|
|
37
|
+
style.borderBottomStyle = this.dashed ? 'dashed' : 'solid'
|
|
38
|
+
style.width = this.$uv.addUnit(this.length)
|
|
39
|
+
if (this.hairline) style.transform = 'scaleY(0.5)'
|
|
40
|
+
} else {
|
|
41
|
+
// 如果是竖向线条,边框宽度为1px,再通过transform缩小一半,就是0.5px了
|
|
42
|
+
style.borderLeftWidth = '1px'
|
|
43
|
+
style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
|
|
44
|
+
style.height = this.$uv.addUnit(this.length)
|
|
45
|
+
if (this.hairline) style.transform = 'scaleX(0.5)'
|
|
46
|
+
}
|
|
47
|
+
style.borderColor = this.color
|
|
48
|
+
return this.$uv.deepMerge(style, this.$uv.addStyle(this.customStyle))
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style lang="scss" scoped>
|
|
55
|
+
.uv-line {
|
|
56
|
+
/* #ifndef APP-NVUE */
|
|
57
|
+
vertical-align: middle;
|
|
58
|
+
/* #endif */
|
|
59
|
+
}
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
props: {
|
|
3
|
+
// 激活部分的颜色
|
|
4
|
+
activeColor: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: '#19be6b'
|
|
7
|
+
},
|
|
8
|
+
inactiveColor: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: '#ececec'
|
|
11
|
+
},
|
|
12
|
+
// 进度百分比,数值
|
|
13
|
+
percentage: {
|
|
14
|
+
type: [String, Number],
|
|
15
|
+
default: 0
|
|
16
|
+
},
|
|
17
|
+
// 是否在进度条内部显示百分比的值
|
|
18
|
+
showText: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
// 进度条的高度,单位px
|
|
23
|
+
height: {
|
|
24
|
+
type: [String, Number],
|
|
25
|
+
default: 12
|
|
26
|
+
},
|
|
27
|
+
...uni.$uv?.props?.lineProgress
|
|
28
|
+
}
|
|
29
|
+
}
|