stellar-ui-v2 1.35.3
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/common/css/common.scss +61 -0
- package/components/ste-animate/README.md +117 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/ste-animate.vue +200 -0
- package/components/ste-badge/README.md +171 -0
- package/components/ste-badge/ste-badge.vue +238 -0
- package/components/ste-barcode/README.md +36 -0
- package/components/ste-barcode/encode2.js +317 -0
- package/components/ste-barcode/ste-barcode.vue +213 -0
- package/components/ste-button/README.md +129 -0
- package/components/ste-button/ste-button.vue +345 -0
- package/components/ste-calendar/README.md +304 -0
- package/components/ste-calendar/self-date.js +119 -0
- package/components/ste-calendar/ste-calendar.vue +578 -0
- package/components/ste-checkbox/README.md +297 -0
- package/components/ste-checkbox/ste-checkbox.vue +305 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
- package/components/ste-code-input/README.md +67 -0
- package/components/ste-code-input/ste-code-input.vue +302 -0
- package/components/ste-date-picker/README.md +135 -0
- package/components/ste-date-picker/ste-date-picker.vue +407 -0
- package/components/ste-drag/README.md +103 -0
- package/components/ste-drag/ste-drag.vue +203 -0
- package/components/ste-dropdown-menu/README.md +358 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
- package/components/ste-icon/README.md +90 -0
- package/components/ste-icon/iconfont.css +8 -0
- package/components/ste-icon/ste-icon.vue +147 -0
- package/components/ste-image/README.md +154 -0
- package/components/ste-image/ste-image.vue +218 -0
- package/components/ste-index-item/ste-index-item.vue +96 -0
- package/components/ste-index-list/README.md +153 -0
- package/components/ste-index-list/ste-index-list.vue +128 -0
- package/components/ste-input/README.md +146 -0
- package/components/ste-input/ste-input.vue +480 -0
- package/components/ste-loading/README.md +81 -0
- package/components/ste-loading/ste-loading.vue +166 -0
- package/components/ste-media-preview/README.md +243 -0
- package/components/ste-media-preview/TouchScaleing.js +102 -0
- package/components/ste-media-preview/ste-media-preview.vue +267 -0
- package/components/ste-message-box/README.md +217 -0
- package/components/ste-message-box/ste-message-box.js +72 -0
- package/components/ste-message-box/ste-message-box.vue +380 -0
- package/components/ste-notice-bar/README.md +129 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
- package/components/ste-number-keyboard/README.md +246 -0
- package/components/ste-number-keyboard/keyboard.vue +140 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
- package/components/ste-picker/ste-picker.vue +258 -0
- package/components/ste-popup/README.md +148 -0
- package/components/ste-popup/ste-popup.vue +337 -0
- package/components/ste-price/README.md +129 -0
- package/components/ste-price/ste-price.vue +258 -0
- package/components/ste-progress/README.md +87 -0
- package/components/ste-progress/ste-progress.vue +200 -0
- package/components/ste-qrcode/README.md +50 -0
- package/components/ste-qrcode/ste-qrcode.vue +164 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/README.md +286 -0
- package/components/ste-radio/ste-radio.vue +293 -0
- package/components/ste-radio-group/ste-radio-group.vue +128 -0
- package/components/ste-rate/README.md +115 -0
- package/components/ste-rate/ste-rate.vue +202 -0
- package/components/ste-read-more/README.md +111 -0
- package/components/ste-read-more/ste-read-more.vue +133 -0
- package/components/ste-rich-text/README.md +31 -0
- package/components/ste-rich-text/ste-rich-text.vue +70 -0
- package/components/ste-scroll-to/README.md +68 -0
- package/components/ste-scroll-to/mixin.js +173 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
- package/components/ste-search/README.md +262 -0
- package/components/ste-search/ste-search.vue +547 -0
- package/components/ste-select/README.md +434 -0
- package/components/ste-select/datapager.vue +62 -0
- package/components/ste-select/datetime.vue +106 -0
- package/components/ste-select/defaultDate.js +142 -0
- package/components/ste-select/ste-select.vue +843 -0
- package/components/ste-signature/README.md +105 -0
- package/components/ste-signature/ste-signature.vue +220 -0
- package/components/ste-slider/README.md +165 -0
- package/components/ste-slider/ste-slider.vue +544 -0
- package/components/ste-step/ste-step.vue +264 -0
- package/components/ste-stepper/README.md +170 -0
- package/components/ste-stepper/ste-stepper.vue +373 -0
- package/components/ste-steps/README.md +132 -0
- package/components/ste-steps/ste-steps.vue +65 -0
- package/components/ste-sticky/README.md +52 -0
- package/components/ste-sticky/ste-sticky.vue +127 -0
- package/components/ste-swipe-action/README.md +197 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
- package/components/ste-swiper/README.md +173 -0
- package/components/ste-swiper/ste-swiper.vue +462 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/README.md +110 -0
- package/components/ste-switch/ste-switch.vue +144 -0
- package/components/ste-tab/ste-tab.vue +87 -0
- package/components/ste-table/README.md +785 -0
- package/components/ste-table/common.js +8 -0
- package/components/ste-table/ste-table.vue +666 -0
- package/components/ste-table/utils.js +20 -0
- package/components/ste-table-column/checkbox-icon.vue +65 -0
- package/components/ste-table-column/common.scss +65 -0
- package/components/ste-table-column/radio-icon.vue +110 -0
- package/components/ste-table-column/ste-table-column.vue +255 -0
- package/components/ste-table-column/sub-table.vue +116 -0
- package/components/ste-table-column/table-popover.vue +204 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/README.md +475 -0
- package/components/ste-tabs/props.js +212 -0
- package/components/ste-tabs/ste-tabs.vue +758 -0
- package/components/ste-text/README.md +66 -0
- package/components/ste-text/ste-text.vue +72 -0
- package/components/ste-toast/README.md +243 -0
- package/components/ste-toast/ste-toast.js +69 -0
- package/components/ste-toast/ste-toast.vue +231 -0
- package/components/ste-touch-swipe/README.md +104 -0
- package/components/ste-touch-swipe/TouchEvent.js +72 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
- package/components/ste-tour/README.md +194 -0
- package/components/ste-tour/ste-tour.vue +355 -0
- package/components/ste-tree/README.md +240 -0
- package/components/ste-tree/ste-tree.vue +350 -0
- package/components/ste-upload/README.md +276 -0
- package/components/ste-upload/ReadFile.js +229 -0
- package/components/ste-upload/ste-upload.vue +526 -0
- package/components/ste-video/README.md +60 -0
- package/components/ste-video/props.js +149 -0
- package/components/ste-video/ste-video.vue +647 -0
- package/config/color.js +22 -0
- package/index.js +2 -0
- package/package.json +19 -0
- package/utils/Color.js +66 -0
- package/utils/System.js +110 -0
- package/utils/dayjs.min.js +1 -0
- package/utils/mixin.js +67 -0
- package/utils/store.js +7 -0
- package/utils/utils.js +604 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# NoticeBar 公告栏
|
|
2
|
+
|
|
3
|
+
用于循环播放展示一组消息通知。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
JavaScript后面的演示代码中涉及到的变量和方法都使用本javasaript代码
|
|
9
|
+
```javascript
|
|
10
|
+
export default {
|
|
11
|
+
data() {
|
|
12
|
+
return {
|
|
13
|
+
list: ['第一条:1111111111111111111111111111', '第二条:2222222222222222222222', '第三条:3333333333333'],
|
|
14
|
+
list2: ['第一条:111', '第二条:222', '第三条:333', '第四条:444'],
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
mounted() {},
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
#### 基础用法
|
|
22
|
+
通过`list`数组参数设置需要滚动的内容,水平滚动。
|
|
23
|
+
```
|
|
24
|
+
<ste-notice-bar :list="list"></ste-notice-bar>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### 自定义样式
|
|
28
|
+
- 通过 `color` 属性设置文字颜色,默认为 `#000000`。
|
|
29
|
+
- 通过 `background` 属性设置背景,默认为 `#ffffff`。
|
|
30
|
+
- 通过 `width` 属性设置宽度,默认为 `100%`,继承父属性。
|
|
31
|
+
```
|
|
32
|
+
<ste-notice-bar :list="list" background="#FBF8DC" color="red" :width="400"></ste-notice-bar>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### 垂直滚动
|
|
36
|
+
通过`direction`设置滚动的方向,`across`:水平,`vertical`:垂直 水平滚动、默认`across`。
|
|
37
|
+
```
|
|
38
|
+
<ste-notice-bar :list="list" direction="vertical"></ste-notice-bar>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### 滚动速率
|
|
42
|
+
通过`acrossSpeed`设置水平方向的滚动速率 `(px/s)`。
|
|
43
|
+
```
|
|
44
|
+
<ste-notice-bar :list="list" :acrossSpeed="10"></ste-notice-bar>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### 滚动的速度
|
|
48
|
+
通过`verticalSpeed`设置垂直方向的滚动的速度`(ms)`。
|
|
49
|
+
```
|
|
50
|
+
<ste-notice-bar :list="list2" direction="vertical" :verticalSpeed="2000"></ste-notice-bar>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### 延时滚动
|
|
54
|
+
通过`delay`设置延时`(ms)`。
|
|
55
|
+
```
|
|
56
|
+
<ste-notice-bar :list="list" :delay="10000"></ste-notice-bar>
|
|
57
|
+
<ste-notice-bar :list="list2" direction="vertical" delay="10000"></ste-notice-bar>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### 停留时间
|
|
61
|
+
通过`standTime`设置每次滚动前停留多少毫秒(竖向滚动时有效)`(ms)`。
|
|
62
|
+
```
|
|
63
|
+
<ste-notice-bar :list="list2" direction="vertical" :standTime="5000"></ste-notice-bar>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### 是否可以滚动
|
|
67
|
+
通过`scrollable`设置公共栏是否可以滚动,默认`true`。
|
|
68
|
+
```
|
|
69
|
+
<ste-notice-bar :list="list" :scrollable="false"></ste-notice-bar>
|
|
70
|
+
<ste-notice-bar :list="list2" direction="vertical" :scrollable="false"></ste-notice-bar>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### 取消按钮
|
|
74
|
+
通过`closeMode`设置是否启用关闭模式,默认`false`。
|
|
75
|
+
```
|
|
76
|
+
<ste-notice-bar :list="list" closeMode></ste-notice-bar>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### 插槽
|
|
80
|
+
通过`leftIcon`设置左边图标的插槽。
|
|
81
|
+
通过`rightIcon`设置右边图标的插槽。
|
|
82
|
+
```
|
|
83
|
+
<ste-notice-bar :list="list">
|
|
84
|
+
<template #leftIcon>
|
|
85
|
+
<ste-icon color="#000000" code="" size="32"></ste-icon>
|
|
86
|
+
</template>
|
|
87
|
+
<template #rightIcon>
|
|
88
|
+
<ste-icon color="#000000" code="" size="32"></ste-icon>
|
|
89
|
+
</template>
|
|
90
|
+
</ste-notice-bar>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
---$
|
|
95
|
+
### API
|
|
96
|
+
#### 组件属性(Props)
|
|
97
|
+
|
|
98
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
99
|
+
| --- | --- | --- | --- | --- | --- |
|
|
100
|
+
| `list` | 滚动数据列表 | `Array` | `[]` | - | - |
|
|
101
|
+
| `direction` | 滚动的方向 | `String` | `across` | `across`:水平<br/>`vertical`:垂直 | - |
|
|
102
|
+
| `closeMode` | 是否启用关闭模式 | `Boolean` | `false` | - | - |
|
|
103
|
+
| `color` | 文字颜色 | `String` | `#000000` | - | - |
|
|
104
|
+
| `background` | 背景 | `String` | `#ffffff` | - | - |
|
|
105
|
+
| `width` | 宽度 | `String\Number` | `100%` | `"100%"`:填满<br/>`{{Number}}`:自定义宽度 单位rpx | - |
|
|
106
|
+
| `acrossSpeed` | 滚动速率 (px/s) | `Number` | `50` | - | - |
|
|
107
|
+
| `verticalSpeed` | 滚动的速度(ms) | `Number` | `500` | - | - |
|
|
108
|
+
| `delay` | 延时(ms) | `Number` | `1000` | - | - |
|
|
109
|
+
| `standTime` | 每次滚动前停留多少毫秒(竖向滚动时有效) | `Number` | `1000` | - | - |
|
|
110
|
+
| `scrollable` | 是否可以滚动 | `Boolean` | `true` | - | - |
|
|
111
|
+
|
|
112
|
+
#### 组件事件(Events)
|
|
113
|
+
|
|
114
|
+
|事件名 |说明 | 事件参数 |支持版本 |
|
|
115
|
+
|--- |--- |--- |--- |
|
|
116
|
+
| `click` | 内容区域点击回调事件 |`index`:结束后的序值 | |
|
|
117
|
+
| `close` | 关闭模式下点击右侧关闭按钮时触发 |`event` | |
|
|
118
|
+
| `end` | 滚动结束时触发 |`index`:结束后的序值 | |
|
|
119
|
+
|
|
120
|
+
#### 组件插槽(Slots)
|
|
121
|
+
|
|
122
|
+
|插槽名 |说明 |插槽参数 |支持版本 |
|
|
123
|
+
|--- |--- |--- |--- |
|
|
124
|
+
|`leftIcon` |左边图标的插槽 |- | |
|
|
125
|
+
|`rightIcon`|右边图标的插槽 |- | |
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
---$
|
|
129
|
+
{{qinpengfei}}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view v-if="closeShow" class="ste-notice-bar-root" :style="[cmpStyle]">
|
|
3
|
+
<view class="msg-box-content" @touchstart="doPause" @touchend="doRun" @mousedown="doPause" @mouseup="doRun">
|
|
4
|
+
<view class="left">
|
|
5
|
+
<slot name="leftIcon">
|
|
6
|
+
<ste-image width="36" height="36" src="https://image.whzb.com/chain/StellarUI/notice-bar/tip.png" />
|
|
7
|
+
</slot>
|
|
8
|
+
</view>
|
|
9
|
+
<view v-if="direction == 'across'" :class="'center ' + id" @click="handleClick">
|
|
10
|
+
<view :id="id" :class="cardMsgClass" :style="[cmpAcrossStyle]" @animationend="onAnimationEnd">
|
|
11
|
+
<ste-rich-text :text="list[index]"></ste-rich-text>
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
<view
|
|
15
|
+
v-else
|
|
16
|
+
:class="'center vertical ' + cardMsgClass"
|
|
17
|
+
@click="handleClick"
|
|
18
|
+
@animationend="onAnimationEnd"
|
|
19
|
+
:style="[cmpVerticalStyle]"
|
|
20
|
+
>
|
|
21
|
+
<view v-for="(item, i) in copyList" :key="i">
|
|
22
|
+
<ste-rich-text :text="item"></ste-rich-text>
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
<view v-if="$slots.rightIcon || closeMode" class="right-icon">
|
|
26
|
+
<slot name="rightIcon">
|
|
27
|
+
<view @click="handleClose">
|
|
28
|
+
<ste-icon code="" size="32" :color="color"></ste-icon>
|
|
29
|
+
</view>
|
|
30
|
+
</slot>
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import utils from '../../utils/utils.js';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* ste-notice-bar 公告栏
|
|
41
|
+
* @description 用于循环播放展示一组消息通知。
|
|
42
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-notice-bar
|
|
43
|
+
* @property {Array} list 滚动数据列表,默认 []
|
|
44
|
+
* @property {String} direction 滚动的方向,默认 across
|
|
45
|
+
* @value across 水平 {String}
|
|
46
|
+
* @value vertical 垂直 {String}
|
|
47
|
+
* @property {Boolean} closeMode 是否启用关闭模式 默认 false
|
|
48
|
+
* @property {String} color 文字颜色,默认 #000000
|
|
49
|
+
* @property {String} background 背景,默认 #ffffff
|
|
50
|
+
* @property {Number|String} width 宽度 默认 100%
|
|
51
|
+
* @value 100% 填满 {String}
|
|
52
|
+
* @value {{Number}} 自定义宽度,单位rpx {Number}
|
|
53
|
+
* @property {Number} acrossSpeed,滚动速率 (px/s),默认 50
|
|
54
|
+
* @property {Number} verticalSpeed,滚动的速度(ms),默认 500
|
|
55
|
+
* @property {Number} delay 延时(ms),默认 1000
|
|
56
|
+
* @property {Number} standTime 每次滚动前停留多少毫秒(竖向滚动时有效)(ms),默认 1000
|
|
57
|
+
* @property {Boolean} scrollable 是否可以滚动 默认 true
|
|
58
|
+
* @event {Function} click 外层点击事件回调
|
|
59
|
+
* @event {Function} close 关闭通知栏时触发
|
|
60
|
+
* @event {Function} end 滚动结束时触发
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
export default {
|
|
64
|
+
group: '展示组件',
|
|
65
|
+
title: 'NoticeBar 公告栏',
|
|
66
|
+
name: 'ste-notice-bar',
|
|
67
|
+
options: {
|
|
68
|
+
virtualHost: true,
|
|
69
|
+
},
|
|
70
|
+
props: {
|
|
71
|
+
list: {
|
|
72
|
+
type: [Array, null],
|
|
73
|
+
default: () => [],
|
|
74
|
+
},
|
|
75
|
+
direction: {
|
|
76
|
+
type: [String, null],
|
|
77
|
+
default: 'across',
|
|
78
|
+
},
|
|
79
|
+
closeMode: {
|
|
80
|
+
type: [Boolean, null],
|
|
81
|
+
default: false,
|
|
82
|
+
},
|
|
83
|
+
color: {
|
|
84
|
+
type: [String, null],
|
|
85
|
+
default: '#000000',
|
|
86
|
+
},
|
|
87
|
+
background: {
|
|
88
|
+
type: [String, null],
|
|
89
|
+
default: '#ffffff',
|
|
90
|
+
},
|
|
91
|
+
width: {
|
|
92
|
+
type: [Number, String, null],
|
|
93
|
+
default: '100%',
|
|
94
|
+
},
|
|
95
|
+
acrossSpeed: {
|
|
96
|
+
type: [Number, null],
|
|
97
|
+
default: 50,
|
|
98
|
+
},
|
|
99
|
+
verticalSpeed: {
|
|
100
|
+
type: [Number, null],
|
|
101
|
+
default: 500,
|
|
102
|
+
},
|
|
103
|
+
delay: {
|
|
104
|
+
type: [Number, null],
|
|
105
|
+
default: 1000,
|
|
106
|
+
},
|
|
107
|
+
standTime: {
|
|
108
|
+
type: [Number, null],
|
|
109
|
+
default: 1000,
|
|
110
|
+
},
|
|
111
|
+
scrollable: {
|
|
112
|
+
type: [Boolean, null],
|
|
113
|
+
default: true,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
data() {
|
|
117
|
+
return {
|
|
118
|
+
id: utils.guid(),
|
|
119
|
+
index: 0,
|
|
120
|
+
touch: false,
|
|
121
|
+
firstDone: false,
|
|
122
|
+
copyList: [],
|
|
123
|
+
acrossDuration: 0,
|
|
124
|
+
textTranslate: 0,
|
|
125
|
+
cardMsgClass: '',
|
|
126
|
+
h5flag: false,
|
|
127
|
+
closeShow: true,
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
async mounted() {},
|
|
131
|
+
watch: {
|
|
132
|
+
list: {
|
|
133
|
+
handler(val) {
|
|
134
|
+
this.copyList = utils.deepClone(val);
|
|
135
|
+
if (val.length && this.scrollable) {
|
|
136
|
+
this.$nextTick(() => {
|
|
137
|
+
this.handleAnimation();
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
deep: true,
|
|
142
|
+
immediate: true,
|
|
143
|
+
},
|
|
144
|
+
index: {
|
|
145
|
+
handler() {
|
|
146
|
+
this.h5flag = false;
|
|
147
|
+
},
|
|
148
|
+
immediate: true,
|
|
149
|
+
},
|
|
150
|
+
copyList: {
|
|
151
|
+
handler() {
|
|
152
|
+
this.h5flag = false;
|
|
153
|
+
},
|
|
154
|
+
immediate: true,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
computed: {
|
|
158
|
+
cmpStyle() {
|
|
159
|
+
let style = {};
|
|
160
|
+
style['width'] = isNaN(Number(this.width)) ? this.width : utils.formatPx(this.width);
|
|
161
|
+
style['background'] = this.background;
|
|
162
|
+
style['color'] = this.color;
|
|
163
|
+
return style;
|
|
164
|
+
},
|
|
165
|
+
cmpAcrossStyle() {
|
|
166
|
+
let style = {};
|
|
167
|
+
style['animationPlayState'] = this.touch ? 'paused' : 'running';
|
|
168
|
+
style['animationDuration'] = this.acrossDuration + 'ms';
|
|
169
|
+
style['animationDelay'] = (this.firstDone ? 0 : this.delay) + 'ms';
|
|
170
|
+
style['transform'] = `translateX(${this.textTranslate}px)`;
|
|
171
|
+
return style;
|
|
172
|
+
},
|
|
173
|
+
cmpVerticalStyle() {
|
|
174
|
+
let style = {};
|
|
175
|
+
style['animationPlayState'] = this.touch ? 'paused' : 'running';
|
|
176
|
+
style['animationDuration'] = this.verticalSpeed + 'ms';
|
|
177
|
+
style['animationDelay'] = (this.firstDone ? 0 : this.delay) + 'ms';
|
|
178
|
+
return style;
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
methods: {
|
|
182
|
+
// 执行滚动动画
|
|
183
|
+
async handleAnimation() {
|
|
184
|
+
if (this.direction == 'across') {
|
|
185
|
+
// 获取滚动消息的长度来计算动画的执行时间
|
|
186
|
+
let dom = await utils.querySelector('#' + this.id, this);
|
|
187
|
+
this.acrossDuration = ((dom.width + this.textTranslate) / Number(this.acrossSpeed)) * 1000;
|
|
188
|
+
this.cardMsgClass = 'across-play-infinite';
|
|
189
|
+
} else {
|
|
190
|
+
this.cardMsgClass = 'vertical-play-infinite';
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
// 动画结束
|
|
194
|
+
async onAnimationEnd() {
|
|
195
|
+
// 解决h5动画初始会触发结束事件
|
|
196
|
+
// #ifdef H5
|
|
197
|
+
if (this.h5flag) {
|
|
198
|
+
// #endif
|
|
199
|
+
if (this.direction == 'across') {
|
|
200
|
+
if (!this.textTranslate) {
|
|
201
|
+
// 获取滚动消息的父级元素的长度实现无缝滚动
|
|
202
|
+
let dom = await utils.querySelector('.' + this.id, this);
|
|
203
|
+
this.textTranslate = dom.width;
|
|
204
|
+
}
|
|
205
|
+
this.cardMsgClass = '';
|
|
206
|
+
// h5里 文本内容切换会导致触发动画结束事件,屏蔽切换
|
|
207
|
+
this.index = this.index + 1 >= this.list.length ? 0 : this.index + 1;
|
|
208
|
+
this.$nextTick(() => {
|
|
209
|
+
this.handleAnimation();
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
this.cardMsgClass = '';
|
|
213
|
+
// h5里 文本内容切换会导致触发动画结束事件,屏蔽切换
|
|
214
|
+
|
|
215
|
+
this.copyList.push(this.copyList.shift());
|
|
216
|
+
|
|
217
|
+
this.index = this.index + 1 >= this.list.length ? 0 : this.index + 1;
|
|
218
|
+
setTimeout(
|
|
219
|
+
() => {
|
|
220
|
+
this.handleAnimation();
|
|
221
|
+
},
|
|
222
|
+
this.standTime > this.verticalSpeed ? this.standTime : this.verticalSpeed // 下一个动画要在前一个动画后
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
this.firstDone = true;
|
|
226
|
+
this.$emit('end', this.index);
|
|
227
|
+
// #ifdef H5
|
|
228
|
+
}
|
|
229
|
+
if (this.direction == 'across') {
|
|
230
|
+
this.h5flag = true;
|
|
231
|
+
} else {
|
|
232
|
+
setTimeout(
|
|
233
|
+
() => {
|
|
234
|
+
this.h5flag = true;
|
|
235
|
+
},
|
|
236
|
+
this.verticalSpeed > 20 ? this.verticalSpeed - 20 : 20
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
// #endif
|
|
240
|
+
},
|
|
241
|
+
// 暂停
|
|
242
|
+
doPause() {
|
|
243
|
+
this.touch = true;
|
|
244
|
+
},
|
|
245
|
+
// 取消暂停
|
|
246
|
+
doRun() {
|
|
247
|
+
this.touch = false;
|
|
248
|
+
},
|
|
249
|
+
handleClose(e) {
|
|
250
|
+
this.closeShow = false;
|
|
251
|
+
this.$emit('close', e);
|
|
252
|
+
},
|
|
253
|
+
handleClick(e) {
|
|
254
|
+
this.$emit('click', this.index);
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<style lang="scss" scoped>
|
|
261
|
+
.ste-notice-bar-root {
|
|
262
|
+
width: 100%;
|
|
263
|
+
height: 68rpx;
|
|
264
|
+
padding: 16rpx;
|
|
265
|
+
background: #ffffff;
|
|
266
|
+
border-radius: 16rpx;
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
|
|
270
|
+
.msg-box-content {
|
|
271
|
+
display: flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
overflow-x: hidden;
|
|
274
|
+
justify-content: flex-start;
|
|
275
|
+
flex: 1;
|
|
276
|
+
height: 100%;
|
|
277
|
+
}
|
|
278
|
+
.left {
|
|
279
|
+
flex-shrink: 0;
|
|
280
|
+
margin-right: 16rpx;
|
|
281
|
+
display: flex;
|
|
282
|
+
align-items: center;
|
|
283
|
+
height: 36rpx;
|
|
284
|
+
line-height: 36rpx;
|
|
285
|
+
}
|
|
286
|
+
.center {
|
|
287
|
+
flex: 1;
|
|
288
|
+
display: flex;
|
|
289
|
+
overflow: hidden;
|
|
290
|
+
|
|
291
|
+
> view {
|
|
292
|
+
font-size: 24rpx;
|
|
293
|
+
display: inline-block;
|
|
294
|
+
width: auto;
|
|
295
|
+
white-space: nowrap;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.across-play-infinite {
|
|
299
|
+
animation: acrossAnimation linear both running;
|
|
300
|
+
animation-iteration-count: 1;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@keyframes acrossAnimation {
|
|
304
|
+
100% {
|
|
305
|
+
transform: translateX(-100%);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.vertical {
|
|
311
|
+
flex-direction: column;
|
|
312
|
+
height: 36rpx;
|
|
313
|
+
line-height: 36rpx;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.vertical-play-infinite {
|
|
317
|
+
animation: verticalAnimation linear both running;
|
|
318
|
+
animation-iteration-count: 1;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
@keyframes verticalAnimation {
|
|
322
|
+
100% {
|
|
323
|
+
transform: translateY(-100%);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.right-icon {
|
|
328
|
+
margin-left: 16rpx;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
</style>
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# NumberKeyboard 数字键盘
|
|
2
|
+
|
|
3
|
+
虚拟数字键盘,用于输入数字、密码或身份证等场景。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
- 以下是公用scss代码
|
|
9
|
+
```scss
|
|
10
|
+
.test-input {
|
|
11
|
+
height: 66rpx;
|
|
12
|
+
line-height: 66rpx;
|
|
13
|
+
background-color: #f5f5f5;
|
|
14
|
+
padding: 0 18rpx;
|
|
15
|
+
font-size: 24rpx;
|
|
16
|
+
.placeholder {
|
|
17
|
+
color: #999;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### 基础用法
|
|
23
|
+
- 属性`value`: 输入的值,支持`v-model`双向绑定
|
|
24
|
+
- 属性`show`: 是否显示键盘,支持`sync`双向绑定
|
|
25
|
+
```html
|
|
26
|
+
<view class="test-input" @click="show1 = true">
|
|
27
|
+
<text v-if="value1">{{ value1 }}</text>
|
|
28
|
+
<text v-else class="placeholder">请输入</text>
|
|
29
|
+
</view>
|
|
30
|
+
<ste-number-keyboard v-model="value1" :show.sync="show1" />
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
export default{
|
|
34
|
+
data(){
|
|
35
|
+
return {
|
|
36
|
+
value1: '',
|
|
37
|
+
show1: false
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
```
|
|
43
|
+
#### 隐藏右侧功能键
|
|
44
|
+
- 属性`rightKeys`: 是否显示右侧功能键,默认显示
|
|
45
|
+
```html
|
|
46
|
+
<view class="test-input" @click="show2 = true">
|
|
47
|
+
<text v-if="value2">{{ value2 }}</text>
|
|
48
|
+
<text v-else class="placeholder">请输入</text>
|
|
49
|
+
</view>
|
|
50
|
+
<ste-number-keyboard :rightKeys="false" v-model="value2" :show.sync="show2" />
|
|
51
|
+
|
|
52
|
+
<script>
|
|
53
|
+
export default{
|
|
54
|
+
data(){
|
|
55
|
+
return {
|
|
56
|
+
value2: '',
|
|
57
|
+
show2: false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
#### 隐藏清除按钮,value最大长度
|
|
64
|
+
- 属性`showClear`: 是否显示清除按钮,默认显示
|
|
65
|
+
- 属性`maxlength`: 最大`value`长度,默认不限制
|
|
66
|
+
```html
|
|
67
|
+
<view class="test-input" @click="show3 = true">
|
|
68
|
+
<text v-if="value3">{{ value3 }}</text>
|
|
69
|
+
<text v-else class="placeholder">请输入</text>
|
|
70
|
+
</view>
|
|
71
|
+
<ste-number-keyboard :showClear="false" v-model="value3" :show.sync="show3" maxlength="6"/>
|
|
72
|
+
|
|
73
|
+
<script>
|
|
74
|
+
export default{
|
|
75
|
+
data(){
|
|
76
|
+
return {
|
|
77
|
+
value3: '',
|
|
78
|
+
show3: false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</script>
|
|
83
|
+
```
|
|
84
|
+
#### 自定义按键
|
|
85
|
+
- 属性`customKeys`: 自定义按键列表,建议不超过两个
|
|
86
|
+
```html
|
|
87
|
+
<view class="test-input" @click="show4 = true">
|
|
88
|
+
<text v-if="value4">{{ value4 }}</text>
|
|
89
|
+
<text v-else class="placeholder">请输入</text>
|
|
90
|
+
</view>
|
|
91
|
+
<ste-number-keyboard :customKeys="['00', '.']" v-model="value4" :show.sync="show4" />
|
|
92
|
+
|
|
93
|
+
<script>
|
|
94
|
+
export default{
|
|
95
|
+
data(){
|
|
96
|
+
return {
|
|
97
|
+
value4: '',
|
|
98
|
+
show4: false
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</script>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### 自定义颜色/字体大小/确定文本
|
|
106
|
+
- 属性`textColor`: 按键文字颜色,默认#333333
|
|
107
|
+
- 属性`textSize`: 按键文字大小,默认48,单位rpx
|
|
108
|
+
- 属性`confirmBg`: 确定按钮背景颜色,默认#0090FF
|
|
109
|
+
- 属性`confirmColor`: 确定按钮文字颜色,默认#FFFFFF
|
|
110
|
+
- 属性`confirmText`: 确定按钮文字,默认"确定"
|
|
111
|
+
```html
|
|
112
|
+
<view class="test-input" @click="show5 = true">
|
|
113
|
+
<text v-if="value5">{{ value5 }}</text>
|
|
114
|
+
<text v-else class="placeholder">请输入</text>
|
|
115
|
+
</view>
|
|
116
|
+
<ste-number-keyboard
|
|
117
|
+
v-model="value5"
|
|
118
|
+
:show.sync="show5"
|
|
119
|
+
textColor="#f00"
|
|
120
|
+
textSize="40"
|
|
121
|
+
confirmBg="#f00"
|
|
122
|
+
confirmColor="#0f0"
|
|
123
|
+
confirmText="完成"
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
<script>
|
|
127
|
+
export default{
|
|
128
|
+
data(){
|
|
129
|
+
return {
|
|
130
|
+
value5: '',
|
|
131
|
+
show5: false
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
</script>
|
|
136
|
+
```
|
|
137
|
+
#### 输入前事件(自定义功能)
|
|
138
|
+
- 属性`customKeys`中自定义一些按钮,如"返回"
|
|
139
|
+
- 需要自定义该按钮功能,可使用`beforeinput`阻止该按钮的默认功能
|
|
140
|
+
- 事件`beforeinput`: 输入前事件
|
|
141
|
+
- 参数1:即将输入的按钮文本
|
|
142
|
+
- 参数2:等待执行回调函数
|
|
143
|
+
- 参数3:继续后续操作函数
|
|
144
|
+
- 参数4:阻止后续操作函数
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<view class="test-input" @click="show6 = true">
|
|
148
|
+
<text v-if="value6">{{ value6 }}</text>
|
|
149
|
+
<text v-else class="placeholder">请输入</text>
|
|
150
|
+
</view>
|
|
151
|
+
<ste-number-keyboard :customKeys="['返回']" v-model="value6" :show.sync="show6" @beforeinput="beforeinput" />
|
|
152
|
+
|
|
153
|
+
<script>
|
|
154
|
+
export default{
|
|
155
|
+
data(){
|
|
156
|
+
return {
|
|
157
|
+
value6: '',
|
|
158
|
+
show6: false
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
methods:{
|
|
162
|
+
beforeinput(v, suspend, next, stop) {
|
|
163
|
+
// 等待后续操作
|
|
164
|
+
suspend();
|
|
165
|
+
// 执行自定义操作
|
|
166
|
+
if (v === '返回') {
|
|
167
|
+
// 阻止默认后续操作
|
|
168
|
+
stop();
|
|
169
|
+
this.showToast({
|
|
170
|
+
title: '点击了返回',
|
|
171
|
+
icon: 'none',
|
|
172
|
+
});
|
|
173
|
+
} else {
|
|
174
|
+
// 继续默认后续操作
|
|
175
|
+
next();
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
</script>
|
|
181
|
+
```
|
|
182
|
+
#### 在文档流中展示
|
|
183
|
+
- 属性`mode`: 键盘模式,
|
|
184
|
+
- 可选值:`popup`在弹窗中展示(默认)
|
|
185
|
+
- 可选值:`page`在文档流中展示
|
|
186
|
+
|
|
187
|
+
```html
|
|
188
|
+
<view class="test-input">
|
|
189
|
+
<text v-if="value7">{{ value7 }}</text>
|
|
190
|
+
<text v-else class="placeholder">请输入</text>
|
|
191
|
+
</view>
|
|
192
|
+
<view style="padding: 30rpx; background-color: #f5f5f5; margin-top: 12rpx">
|
|
193
|
+
<ste-number-keyboard mode="page" v-model="value7" />
|
|
194
|
+
</view>
|
|
195
|
+
|
|
196
|
+
<script>
|
|
197
|
+
export default{
|
|
198
|
+
data(){
|
|
199
|
+
return {
|
|
200
|
+
value7: '',
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
}
|
|
204
|
+
</script>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---$
|
|
208
|
+
### API
|
|
209
|
+
#### 组件属性(Props)
|
|
210
|
+
|
|
211
|
+
| 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
212
|
+
| --- | --- | --- | --- | --- | --- |
|
|
213
|
+
| `mode` | 键盘模式 | `String` | `popup` | `popup`弹窗展示<br/>`page`在文档流中展示 | - |
|
|
214
|
+
| `value` | 输入值,支持`v-model`双向绑定 | `String` | - | - | - |
|
|
215
|
+
| `maxlength` | `value`最大长度 | `Number`,`String` | - | - | - |
|
|
216
|
+
| `show` | 是否显示键盘,支持`.sync`绑定,mode="popup"时生效 | `Boolean` | `false` | - | - |
|
|
217
|
+
| `rightKeys` | 是否显示右侧功能键 | `Boolean` | `true` | - | - |
|
|
218
|
+
| `randomKeys` | 按键是否随机排列 | `Boolean` | `false` | - | - |
|
|
219
|
+
| `confirmText` | 右侧确认按钮文本 | `String` | `确定` | - | - |
|
|
220
|
+
| `confirmDisabled` | 右侧确认是否禁用 | `Boolean` | `false` | - | - |
|
|
221
|
+
| `customKeys` | 自定义按键,建议数量不大于2 | `Array<String>` | `[]` | - | - |
|
|
222
|
+
| `showClear` | 是否显示清空按钮 | `Boolean` | `true` | - | - |
|
|
223
|
+
| `textColor` | 按键文字颜色 | `String` | `#000000` | - | - |
|
|
224
|
+
| `textSize` | 按键文字大小 | `Number`,`String` | `48` | - | - |
|
|
225
|
+
| `confirmBg` | 确认按钮背景颜色 | `String` | `#0090FF` | - | - |
|
|
226
|
+
| `confirmColor` | 确认按钮文字颜色 | `String` | `#FFFFFF` | - | - |
|
|
227
|
+
|
|
228
|
+
#### 组件事件(Event)
|
|
229
|
+
| 事件名 | 说明 | 事件参数 |支持版本 |
|
|
230
|
+
|--- |--- |--- |--- |
|
|
231
|
+
| `change` | 输入值`value`改变时触发 | `value`:当前的绑定值 |- |
|
|
232
|
+
| `clear` | 清空按钮点击事件 | - |- |
|
|
233
|
+
| `backspace` | 删除按钮点击事件 | - |- |
|
|
234
|
+
| `confirm` | 确认按钮点击事件 | - |- |
|
|
235
|
+
| `click` | 点击功能键(确认/删除/清除)之外的键盘触发 | - |- |
|
|
236
|
+
| `beforeinput` | 输入之前触发,功能键之外的键盘点击时为输入 | 参数1为当前点击的按钮<br/>参数2为开启等待的回调函数<br/>参数3为执行后续操作的回调函数<br/>参数4为阻止后续执行的回调函数 |- |
|
|
237
|
+
| `close` | 关闭弹窗键盘触发 | - |- |
|
|
238
|
+
| `open` | 打开弹窗键盘触发 | - |- |
|
|
239
|
+
#### 组件插槽(Slot)
|
|
240
|
+
|
|
241
|
+
|插槽名 |说明 |插槽参数 |支持版本 |
|
|
242
|
+
|--- |--- |--- |--- |
|
|
243
|
+
| default | 弹窗标题插槽 |- |- |
|
|
244
|
+
|
|
245
|
+
---$
|
|
246
|
+
{{xuyajun}}
|