@10yun/cv-mobile-ui 0.4.1 → 0.4.2

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.
Files changed (112) hide show
  1. package/package.json +1 -1
  2. package/ui-cv/cv-badge/{uni-badge.vue → cv-badge.vue} +2 -2
  3. package/ui-cv/cv-calendar/calendar.js +762 -345
  4. package/ui-cv/cv-calendar/cv-calendar-item.vue +198 -0
  5. package/ui-cv/cv-calendar/cv-calendar.vue +508 -0
  6. package/ui-cv/cv-card/cv-card.vue +427 -0
  7. package/ui-cv/cv-col/cv-col.vue +2965 -0
  8. package/ui-cv/cv-collapse/cv-collapse.vue +146 -0
  9. package/ui-cv/cv-collapse-item/cv-collapse-item.vue +395 -0
  10. package/ui-cv/cv-combox/cv-combox.vue +250 -0
  11. package/ui-cv/cv-countdown/cv-countdown.vue +245 -0
  12. package/ui-cv/cv-data-checkbox/cv-data-checkbox.vue +841 -0
  13. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list-item.vue +154 -0
  14. package/ui-cv/cv-data-indexed-list/cv-data-indexed-list.vue +376 -0
  15. package/ui-cv/cv-data-picker/cv-data-picker.vue +486 -0
  16. package/ui-cv/cv-data-pickerview/{uni-data-picker.js → cv-data-picker.js} +0 -0
  17. package/ui-cv/cv-data-pickerview/cv-data-pickerview.vue +304 -0
  18. package/ui-cv/cv-dateformat/cv-dateformat.vue +86 -0
  19. package/ui-cv/cv-datetime-picker/calendar.vue +752 -738
  20. package/ui-cv/cv-datetime-picker/cv-datetime-picker.vue +958 -0
  21. package/ui-cv/cv-datetime-picker/time-picker.vue +900 -892
  22. package/ui-cv/cv-easyinput/cv-easyinput.vue +514 -0
  23. package/ui-cv/cv-fab/cv-fab.vue +465 -0
  24. package/ui-cv/cv-fab/{uni-fab.vue.bak → cv-fab.vue.bak} +2 -2
  25. package/ui-cv/cv-fav/cv-fav.vue +150 -0
  26. package/ui-cv/cv-file-picker/cv-file-picker.vue +619 -0
  27. package/ui-cv/cv-form-item/cv-form-item.vue +1 -1
  28. package/ui-cv/cv-goods-nav/{uni-goods-nav.vue → cv-goods-nav.vue} +1 -1
  29. package/ui-cv/{cv-icons2/cv-icons2.vue → cv-icon2/cv-icon2.vue} +3 -3
  30. package/ui-cv/{cv-icons2 → cv-icon2}/icons.js +0 -0
  31. package/ui-cv/{cv-icons2 → cv-icon2}/uni.ttf +0 -0
  32. package/ui-cv/cv-indexed-list/cv-indexed-list-item.vue +154 -0
  33. package/ui-cv/cv-indexed-list/cv-indexed-list.vue +371 -0
  34. package/ui-cv/cv-input-password/cv-input-password.vue +2 -2
  35. package/ui-cv/{cv-link/uni-link.vue → cv-link2/cv-link2.vue} +1 -1
  36. package/ui-cv/cv-list/cv-list.vue +107 -0
  37. package/ui-cv/cv-list/cv-refresh.vue +65 -0
  38. package/ui-cv/cv-list-ad/cv-list-ad.vue +113 -0
  39. package/ui-cv/cv-list-chat/{uni-list-chat.scss → cv-list-chat.scss} +0 -0
  40. package/ui-cv/cv-list-chat/{uni-list-chat.vue → cv-list-chat.vue} +0 -0
  41. package/ui-cv/cv-list-item/cv-list-item.vue +449 -0
  42. package/ui-cv/cv-nav-bar/cv-nav-bar.vue +256 -0
  43. package/ui-cv/cv-nav-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
  44. package/ui-cv/cv-notice-bar/cv-notice-bar.vue +453 -0
  45. package/ui-cv/cv-number-box/cv-number-box.vue +223 -0
  46. package/ui-cv/cv-pagination/cv-pagination.vue +397 -0
  47. package/ui-cv/cv-popup/cv-popup.vue +429 -0
  48. package/ui-cv/cv-popup-dialog/{uni-popup-dialog.vue → cv-popup-dialog.vue} +0 -0
  49. package/ui-cv/cv-popup-message/cv-popup-message.vue +143 -0
  50. package/ui-cv/cv-popup-share/{uni-popup-share.vue → cv-popup-share.vue} +0 -0
  51. package/ui-cv/cv-row/{uni-row.vue → cv-row.vue} +1 -1
  52. package/ui-cv/cv-search-bar/cv-search-bar.vue +280 -0
  53. package/ui-cv/cv-section/{uni-section.vue → cv-section.vue} +0 -0
  54. package/ui-cv/cv-segmented-control/{uni-segmented-control.vue → cv-segmented-control.vue} +0 -0
  55. package/ui-cv/cv-status-bar/{uni-status-bar.vue → cv-status-bar.vue} +0 -0
  56. package/ui-cv/cv-steps/cv-steps.vue +293 -0
  57. package/ui-cv/cv-swipe-action/{uni-swipe-action.vue → cv-swipe-action.vue} +0 -0
  58. package/ui-cv/cv-swipe-action-item/{uni-swipe-action-item.vue → cv-swipe-action-item.vue} +0 -0
  59. package/ui-cv/cv-swiper-dot/cv-swiper-dot.vue +255 -0
  60. package/ui-cv/cv-table/cv-table.vue +460 -0
  61. package/ui-cv/cv-tag/cv-tag.vue +276 -0
  62. package/ui-cv/cv-tbody/cv-tbody.vue +28 -0
  63. package/ui-cv/cv-td/cv-td.vue +93 -0
  64. package/ui-cv/cv-test/{uni-test.vue → cv-test.vue} +0 -0
  65. package/ui-cv/cv-th/cv-th.vue +270 -0
  66. package/ui-cv/cv-thead/cv-thead.vue +114 -0
  67. package/ui-cv/cv-title/cv-title.vue +168 -0
  68. package/ui-cv/cv-tr/cv-tr.vue +166 -0
  69. package/ui-cv/cv-transition/cv-transition.vue +279 -0
  70. package/ui-cv/cv-calendar/uni-calendar-item.vue +0 -171
  71. package/ui-cv/cv-calendar/uni-calendar.vue +0 -504
  72. package/ui-cv/cv-card/uni-card.vue +0 -420
  73. package/ui-cv/cv-col/uni-col.vue +0 -2968
  74. package/ui-cv/cv-collapse/uni-collapse.vue +0 -146
  75. package/ui-cv/cv-collapse-item/uni-collapse-item.vue +0 -378
  76. package/ui-cv/cv-combox/uni-combox.vue +0 -237
  77. package/ui-cv/cv-countdown/uni-countdown.vue +0 -234
  78. package/ui-cv/cv-data-checkbox/uni-data-checkbox.vue +0 -792
  79. package/ui-cv/cv-data-indexed-list/uni-data-indexed-list-item.vue +0 -142
  80. package/ui-cv/cv-data-indexed-list/uni-data-indexed-list.vue +0 -364
  81. package/ui-cv/cv-data-picker/uni-data-picker.vue +0 -468
  82. package/ui-cv/cv-data-pickerview/uni-data-pickerview.vue +0 -298
  83. package/ui-cv/cv-dateformat/uni-dateformat.vue +0 -88
  84. package/ui-cv/cv-datetime-picker/uni-datetime-picker.vue +0 -874
  85. package/ui-cv/cv-easyinput/uni-easyinput.vue +0 -438
  86. package/ui-cv/cv-fab/uni-fab.vue +0 -443
  87. package/ui-cv/cv-fav/uni-fav.vue +0 -136
  88. package/ui-cv/cv-file-picker/uni-file-picker.vue +0 -614
  89. package/ui-cv/cv-indexed-list/uni-indexed-list-item.vue +0 -142
  90. package/ui-cv/cv-indexed-list/uni-indexed-list.vue +0 -357
  91. package/ui-cv/cv-list/uni-list.vue +0 -107
  92. package/ui-cv/cv-list/uni-refresh.vue +0 -65
  93. package/ui-cv/cv-list-ad/uni-list-ad.vue +0 -106
  94. package/ui-cv/cv-list-item/uni-list-item.vue +0 -428
  95. package/ui-cv/cv-nav-bar/uni-nav-bar.vue +0 -244
  96. package/ui-cv/cv-notice-bar/uni-notice-bar.vue +0 -394
  97. package/ui-cv/cv-number-box/uni-number-box.vue +0 -224
  98. package/ui-cv/cv-pagination/uni-pagination.vue +0 -376
  99. package/ui-cv/cv-popup/uni-popup.vue +0 -412
  100. package/ui-cv/cv-popup-message/uni-popup-message.vue +0 -143
  101. package/ui-cv/cv-search-bar/uni-search-bar.vue +0 -262
  102. package/ui-cv/cv-steps/uni-steps.vue +0 -250
  103. package/ui-cv/cv-swiper-dot/uni-swiper-dot.vue +0 -205
  104. package/ui-cv/cv-table/uni-table.vue +0 -455
  105. package/ui-cv/cv-tag/uni-tag.vue +0 -283
  106. package/ui-cv/cv-tbody/uni-tbody.vue +0 -30
  107. package/ui-cv/cv-td/uni-td.vue +0 -88
  108. package/ui-cv/cv-th/uni-th.vue +0 -259
  109. package/ui-cv/cv-thead/uni-thead.vue +0 -114
  110. package/ui-cv/cv-title/uni-title.vue +0 -171
  111. package/ui-cv/cv-tr/uni-tr.vue +0 -156
  112. package/ui-cv/cv-transition/uni-transition.vue +0 -287
@@ -1,244 +0,0 @@
1
- <template>
2
- <view class="uni-navbar">
3
- <view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }" :style="{ 'background-color': backgroundColor }" class="uni-navbar__content">
4
- <status-bar v-if="statusBar" />
5
- <view :style="{ color: color,backgroundColor: backgroundColor }" class="uni-navbar__header uni-navbar__content_view">
6
- <view @tap="onClickLeft" class="uni-navbar__header-btns uni-navbar__header-btns-left uni-navbar__content_view">
7
- <view class="uni-navbar__content_view" v-if="leftIcon.length">
8
- <uni-icons :color="color" :type="leftIcon" size="24" />
9
- </view>
10
- <view :class="{ 'uni-navbar-btn-icon-left': !leftIcon.length }" class="uni-navbar-btn-text uni-navbar__content_view" v-if="leftText.length">
11
- <text :style="{ color: color, fontSize: '14px' }">{{ leftText }}</text>
12
- </view>
13
- <slot name="left" />
14
- </view>
15
- <view class="uni-navbar__header-container uni-navbar__content_view" @tap="onClickTitle">
16
- <view class="uni-navbar__header-container-inner uni-navbar__content_view" v-if="title.length">
17
- <text class="uni-nav-bar-text" :style="{color: color }">{{ title }}</text>
18
- </view>
19
- <!-- 标题插槽 -->
20
- <slot />
21
- </view>
22
- <view :class="title.length ? 'uni-navbar__header-btns-right' : ''" @tap="onClickRight" class="uni-navbar__header-btns uni-navbar__content_view">
23
- <view class="uni-navbar__content_view" v-if="rightIcon.length">
24
- <uni-icons :color="color" :type="rightIcon" size="24" />
25
- </view>
26
- <!-- 优先显示图标 -->
27
- <view class="uni-navbar-btn-text uni-navbar__content_view" v-if="rightText.length && !rightIcon.length">
28
- <text class="uni-nav-bar-right-text">{{ rightText }}</text>
29
- </view>
30
- <slot name="right" />
31
- </view>
32
- </view>
33
- </view>
34
- <view class="uni-navbar__placeholder" v-if="fixed">
35
- <status-bar v-if="statusBar" />
36
- <view class="uni-navbar__placeholder-view" />
37
- </view>
38
- </view>
39
- </template>
40
-
41
- <script>
42
- import statusBar from "./uni-status-bar.vue";
43
-
44
- /**
45
- * NavBar 自定义导航栏
46
- * @description 导航栏组件,主要用于头部导航
47
- * @tutorial https://ext.dcloud.net.cn/plugin?id=52
48
- * @property {String} title 标题文字
49
- * @property {String} leftText 左侧按钮文本
50
- * @property {String} rightText 右侧按钮文本
51
- * @property {String} leftIcon 左侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
52
- * @property {String} rightIcon 右侧按钮图标(图标类型参考 [Icon 图标](http://ext.dcloud.net.cn/plugin?id=28) type 属性)
53
- * @property {String} color 图标和文字颜色
54
- * @property {String} backgroundColor 导航栏背景颜色
55
- * @property {Boolean} fixed = [true|false] 是否固定顶部
56
- * @property {Boolean} statusBar = [true|false] 是否包含状态栏
57
- * @property {Boolean} shadow = [true|false] 导航栏下是否有阴影
58
- * @event {Function} clickLeft 左侧按钮点击时触发
59
- * @event {Function} clickRight 右侧按钮点击时触发
60
- * @event {Function} clickTitle 中间标题点击时触发
61
- */
62
- export default {
63
- name: "UniNavBar",
64
- components: {
65
- statusBar
66
- },
67
- emits: ['clickLeft', 'clickRight', 'clickTitle'],
68
- props: {
69
- title: {
70
- type: String,
71
- default: ""
72
- },
73
- leftText: {
74
- type: String,
75
- default: ""
76
- },
77
- rightText: {
78
- type: String,
79
- default: ""
80
- },
81
- leftIcon: {
82
- type: String,
83
- default: ""
84
- },
85
- rightIcon: {
86
- type: String,
87
- default: ""
88
- },
89
- fixed: {
90
- type: [Boolean, String],
91
- default: false
92
- },
93
- color: {
94
- type: String,
95
- default: "#000000"
96
- },
97
- backgroundColor: {
98
- type: String,
99
- default: "#FFFFFF"
100
- },
101
- statusBar: {
102
- type: [Boolean, String],
103
- default: false
104
- },
105
- shadow: {
106
- type: [Boolean, String],
107
- default: false
108
- },
109
- border: {
110
- type: [Boolean, String],
111
- default: true
112
- }
113
- },
114
- mounted() {
115
- if (uni.report && this.title !== '') {
116
- uni.report('title', this.title)
117
- }
118
- },
119
- methods: {
120
- onClickLeft() {
121
- this.$emit("clickLeft");
122
- },
123
- onClickRight() {
124
- this.$emit("clickRight");
125
- },
126
- onClickTitle() {
127
- this.$emit("clickTitle");
128
- }
129
- }
130
- };
131
- </script>
132
-
133
- <style scoped>
134
- .uni-nav-bar-text {
135
- /* #ifdef APP-PLUS */
136
- font-size: 34rpx;
137
- /* #endif */
138
- /* #ifndef APP-PLUS */
139
- font-size: 16px;
140
- /* #endif */
141
- }
142
-
143
- .uni-nav-bar-right-text {
144
- font-size: 14px;
145
- }
146
-
147
- .uni-navbar__content {
148
- position: relative;
149
- background-color: #ffffff;
150
- overflow: hidden;
151
- }
152
-
153
- .uni-navbar__content_view {
154
- /* #ifndef APP-NVUE */
155
- display: flex;
156
- /* #endif */
157
- align-items: center;
158
- flex-direction: row;
159
- }
160
-
161
- .uni-navbar__header {
162
- /* #ifndef APP-NVUE */
163
- display: flex;
164
- /* #endif */
165
- flex-direction: row;
166
- height: 44px;
167
- line-height: 44px;
168
- font-size: 16px;
169
- }
170
-
171
- .uni-navbar__header-btns {
172
- /* #ifndef APP-NVUE */
173
- display: flex;
174
- /* #endif */
175
- flex-wrap: nowrap;
176
- width: 120rpx;
177
- padding: 0 6px;
178
- justify-content: center;
179
- align-items: center;
180
- /* #ifdef H5 */
181
- cursor: pointer;
182
- /* #endif */
183
- }
184
-
185
- .uni-navbar__header-btns-left {
186
- /* #ifndef APP-NVUE */
187
- display: flex;
188
- /* #endif */
189
- width: 150rpx;
190
- justify-content: flex-start;
191
- }
192
-
193
- .uni-navbar__header-btns-right {
194
- /* #ifndef APP-NVUE */
195
- display: flex;
196
- /* #endif */
197
- width: 150rpx;
198
- padding-right: 30rpx;
199
- justify-content: flex-end;
200
- }
201
-
202
- .uni-navbar__header-container {
203
- flex: 1;
204
- }
205
-
206
- .uni-navbar__header-container-inner {
207
- /* #ifndef APP-NVUE */
208
- display: flex;
209
- /* #endif */
210
- flex: 1;
211
- align-items: center;
212
- justify-content: center;
213
- font-size: 14px;
214
- }
215
-
216
- .uni-navbar__placeholder-view {
217
- height: 44px;
218
- }
219
-
220
- .uni-navbar--fixed {
221
- position: fixed;
222
- z-index: 998;
223
- /* #ifdef H5 */
224
- left: var(--window-left);
225
- right: var(--window-right);
226
- /* #endif */
227
- /* #ifndef H5 */
228
- left: 0;
229
- right: 0;
230
- /* #endif */
231
- }
232
-
233
- .uni-navbar--shadow {
234
- /* #ifndef APP-NVUE */
235
- box-shadow: 0 1px 6px #ccc;
236
- /* #endif */
237
- }
238
-
239
- .uni-navbar--border {
240
- border-bottom-width: 1rpx;
241
- border-bottom-style: solid;
242
- border-bottom-color: #e5e5e5;
243
- }
244
- </style>
@@ -1,394 +0,0 @@
1
- <template>
2
- <view v-if="show" class="uni-noticebar" :style="{ backgroundColor: backgroundColor }" @click="onClick">
3
- <!-- #ifdef MP-ALIPAY -->
4
- <view v-if="showClose === true || showClose === 'true'" class="uni-noticebar-close uni-cursor-point" @click="close">
5
- <uni-icons type="closeempty" :color="color" size="12" />
6
- </view>
7
- <view v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon">
8
- <uni-icons type="sound" :color="color" size="14" />
9
- </view>
10
- <!-- #endif -->
11
- <!-- #ifndef MP-ALIPAY -->
12
- <uni-icons v-if="showClose === true || showClose === 'true'" class="uni-noticebar-close uni-cursor-point" type="closeempty" :color="color" size="12" @click="close" />
13
- <uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound" :color="color" size="14" />
14
- <!-- #endif -->
15
- <view ref="textBox" class="uni-noticebar__content-wrapper" :class="{'uni-noticebar__content-wrapper--scrollable':scrollable, 'uni-noticebar__content-wrapper--single':!scrollable && (single || moreText)}">
16
- <view :id="elIdBox" class="uni-noticebar__content" :class="{'uni-noticebar__content--scrollable':scrollable, 'uni-noticebar__content--single':!scrollable && (single || moreText)}">
17
- <text :id="elId" ref="animationEle" class="uni-noticebar__content-text" :class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || moreText)}" :style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}</text>
18
- </view>
19
- </view>
20
- <view v-if="showGetMore === true || showGetMore === 'true'" class="uni-noticebar__more uni-cursor-point" @click="clickMore">
21
- <text v-if="moreText" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text>
22
- <uni-icons type="arrowright" :color="moreColor" size="14" />
23
- </view>
24
- </view>
25
- </template>
26
-
27
- <script>
28
- // #ifdef APP-NVUE
29
- const dom = weex.requireModule('dom');
30
- const animation = weex.requireModule('animation');
31
- // #endif
32
-
33
- /**
34
- * NoticeBar 自定义导航栏
35
- * @description 通告栏组件
36
- * @tutorial https://ext.dcloud.net.cn/plugin?id=30
37
- * @property {Number} speed 文字滚动的速度,默认100px/秒
38
- * @property {String} text 显示文字
39
- * @property {String} backgroundColor 背景颜色
40
- * @property {String} color 文字颜色
41
- * @property {String} moreColor 查看更多文字的颜色
42
- * @property {String} moreText 设置“查看更多”的文本
43
- * @property {Boolean} single = [true|false] 是否单行
44
- * @property {Boolean} scrollable = [true|false] 是否滚动,为true时,NoticeBar为单行
45
- * @property {Boolean} showIcon = [true|false] 是否显示左侧喇叭图标
46
- * @property {Boolean} showClose = [true|false] 是否显示左侧关闭按钮
47
- * @property {Boolean} showGetMore = [true|false] 是否显示右侧查看更多图标,为true时,NoticeBar为单行
48
- * @event {Function} click 点击 NoticeBar 触发事件
49
- * @event {Function} close 关闭 NoticeBar 触发事件
50
- * @event {Function} getmore 点击”查看更多“时触发事件
51
- */
52
-
53
- export default {
54
- name: 'UniNoticeBar',
55
- emits: ['click', 'getmore', 'close'],
56
- props: {
57
- text: {
58
- type: String,
59
- default: ''
60
- },
61
- moreText: {
62
- type: String,
63
- default: ''
64
- },
65
- backgroundColor: {
66
- type: String,
67
- default: '#fffbe8'
68
- },
69
- speed: {
70
- // 默认1s滚动100px
71
- type: Number,
72
- default: 100
73
- },
74
- color: {
75
- type: String,
76
- default: '#de8c17'
77
- },
78
- moreColor: {
79
- type: String,
80
- default: '#999999'
81
- },
82
- single: {
83
- // 是否单行
84
- type: [Boolean, String],
85
- default: false
86
- },
87
- scrollable: {
88
- // 是否滚动,添加后控制单行效果取消
89
- type: [Boolean, String],
90
- default: false
91
- },
92
- showIcon: {
93
- // 是否显示左侧icon
94
- type: [Boolean, String],
95
- default: false
96
- },
97
- showGetMore: {
98
- // 是否显示右侧查看更多
99
- type: [Boolean, String],
100
- default: false
101
- },
102
- showClose: {
103
- // 是否显示左侧关闭按钮
104
- type: [Boolean, String],
105
- default: false
106
- }
107
- },
108
- data() {
109
- const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
110
- const elIdBox = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`
111
- return {
112
- textWidth: 0,
113
- boxWidth: 0,
114
- wrapWidth: '',
115
- webviewHide: false,
116
- // #ifdef APP-NVUE
117
- stopAnimation: false,
118
- // #endif
119
- elId: elId,
120
- elIdBox: elIdBox,
121
- show: true,
122
- animationDuration: 'none',
123
- animationPlayState: 'paused',
124
- animationDelay: '0s'
125
- }
126
- },
127
- mounted() {
128
- // #ifdef APP-PLUS
129
- var pages = getCurrentPages();
130
- var page = pages[pages.length - 1];
131
- var currentWebview = page.$getAppWebview();
132
- currentWebview.addEventListener('hide', () => {
133
- this.webviewHide = true
134
- })
135
- currentWebview.addEventListener('show', () => {
136
- this.webviewHide = false
137
- })
138
- // #endif
139
- this.$nextTick(() => {
140
- this.initSize()
141
- })
142
- },
143
- // #ifdef APP-NVUE
144
- beforeDestroy() {
145
- this.stopAnimation = true
146
- },
147
- // #endif
148
- methods: {
149
- initSize() {
150
- if (this.scrollable) {
151
- // #ifndef APP-NVUE
152
- let query = [],
153
- boxWidth = 0,
154
- textWidth = 0;
155
- let textQuery = new Promise((resolve, reject) => {
156
- uni.createSelectorQuery()
157
- // #ifndef MP-ALIPAY
158
- .in(this)
159
- // #endif
160
- .select(`#${this.elId}`)
161
- .boundingClientRect()
162
- .exec(ret => {
163
- this.textWidth = ret[0].width
164
- resolve()
165
- })
166
- })
167
- let boxQuery = new Promise((resolve, reject) => {
168
- uni.createSelectorQuery()
169
- // #ifndef MP-ALIPAY
170
- .in(this)
171
- // #endif
172
- .select(`#${this.elIdBox}`)
173
- .boundingClientRect()
174
- .exec(ret => {
175
- this.boxWidth = ret[0].width
176
- resolve()
177
- })
178
- })
179
- query.push(textQuery)
180
- query.push(boxQuery)
181
- Promise.all(query).then(() => {
182
- this.animationDuration = `${this.textWidth / this.speed}s`
183
- this.animationDelay = `-${this.boxWidth / this.speed}s`
184
- setTimeout(() => {
185
- this.animationPlayState = 'running'
186
- }, 1000)
187
- })
188
- // #endif
189
- // #ifdef APP-NVUE
190
- dom.getComponentRect(this.$refs['animationEle'], (res) => {
191
- let winWidth = uni.getSystemInfoSync().windowWidth
192
- this.textWidth = res.size.width
193
- animation.transition(this.$refs['animationEle'], {
194
- styles: {
195
- transform: `translateX(-${winWidth}px)`
196
- },
197
- duration: 0,
198
- timingFunction: 'linear',
199
- delay: 0
200
- }, () => {
201
- if (!this.stopAnimation) {
202
- animation.transition(this.$refs['animationEle'], {
203
- styles: {
204
- transform: `translateX(-${this.textWidth}px)`
205
- },
206
- timingFunction: 'linear',
207
- duration: (this.textWidth - winWidth) / this.speed * 1000,
208
- delay: 1000
209
- }, () => {
210
- if (!this.stopAnimation) {
211
- this.loopAnimation()
212
- }
213
- });
214
- }
215
- });
216
- })
217
- // #endif
218
- }
219
- // #ifdef APP-NVUE
220
- if (!this.scrollable && (this.single || this.moreText)) {
221
- dom.getComponentRect(this.$refs['textBox'], (res) => {
222
- this.wrapWidth = res.size.width
223
- })
224
- }
225
- // #endif
226
- },
227
- loopAnimation() {
228
- // #ifdef APP-NVUE
229
- animation.transition(this.$refs['animationEle'], {
230
- styles: {
231
- transform: `translateX(0px)`
232
- },
233
- duration: 0
234
- }, () => {
235
- if (!this.stopAnimation) {
236
- animation.transition(this.$refs['animationEle'], {
237
- styles: {
238
- transform: `translateX(-${this.textWidth}px)`
239
- },
240
- duration: this.textWidth / this.speed * 1000,
241
- timingFunction: 'linear',
242
- delay: 0
243
- }, () => {
244
- if (!this.stopAnimation) {
245
- this.loopAnimation()
246
- }
247
- });
248
- }
249
- });
250
- // #endif
251
- },
252
- clickMore() {
253
- this.$emit('getmore')
254
- },
255
- close() {
256
- this.show = false;
257
- this.$emit('close')
258
- },
259
- onClick() {
260
- this.$emit('click')
261
- }
262
- }
263
- }
264
- </script>
265
-
266
- <style scoped>
267
- .uni-noticebar {
268
- /* #ifndef APP-NVUE */
269
- display: flex;
270
- width: 100%;
271
- box-sizing: border-box;
272
- /* #endif */
273
- flex-direction: row;
274
- align-items: center;
275
- padding: 6px 12px;
276
- margin-bottom: 10px;
277
- }
278
-
279
- .uni-cursor-point {
280
- /* #ifdef H5 */
281
- cursor: pointer;
282
- /* #endif */
283
- }
284
-
285
- .uni-noticebar-close {
286
- margin-right: 5px;
287
- }
288
-
289
- .uni-noticebar-icon {
290
- margin-right: 5px;
291
- }
292
-
293
- .uni-noticebar__content-wrapper {
294
- flex: 1;
295
- flex-direction: column;
296
- overflow: hidden;
297
- }
298
-
299
- .uni-noticebar__content-wrapper--single {
300
- /* #ifndef APP-NVUE */
301
- line-height: 18px;
302
- /* #endif */
303
- }
304
-
305
- .uni-noticebar__content-wrapper--single,
306
- .uni-noticebar__content-wrapper--scrollable {
307
- flex-direction: row;
308
- }
309
-
310
- /* #ifndef APP-NVUE */
311
- .uni-noticebar__content-wrapper--scrollable {
312
- position: relative;
313
- height: 18px;
314
- }
315
-
316
- /* #endif */
317
- .uni-noticebar__content--scrollable {
318
- /* #ifdef APP-NVUE */
319
- flex: 0;
320
- /* #endif */
321
- /* #ifndef APP-NVUE */
322
- flex: 1;
323
- display: block;
324
- overflow: hidden;
325
- /* #endif */
326
- }
327
-
328
- .uni-noticebar__content--single {
329
- /* #ifndef APP-NVUE */
330
- display: flex;
331
- flex: none;
332
- width: 100%;
333
- justify-content: center;
334
- /* #endif */
335
- }
336
-
337
- .uni-noticebar__content-text {
338
- font-size: 14px;
339
- line-height: 18px;
340
- /* #ifndef APP-NVUE */
341
- word-break: break-all;
342
- /* #endif */
343
- }
344
-
345
- .uni-noticebar__content-text--single {
346
- /* #ifdef APP-NVUE */
347
- lines: 1;
348
- /* #endif */
349
- /* #ifndef APP-NVUE */
350
- display: block;
351
- width: 100%;
352
- white-space: nowrap;
353
- /* #endif */
354
- overflow: hidden;
355
- text-overflow: ellipsis;
356
- }
357
-
358
- .uni-noticebar__content-text--scrollable {
359
- /* #ifdef APP-NVUE */
360
- lines: 1;
361
- padding-left: 750rpx;
362
- /* #endif */
363
- /* #ifndef APP-NVUE */
364
- position: absolute;
365
- display: block;
366
- height: 18px;
367
- line-height: 18px;
368
- white-space: nowrap;
369
- padding-left: 100%;
370
- animation: notice 10s 0s linear infinite both;
371
- animation-play-state: paused;
372
- /* #endif */
373
- }
374
-
375
- .uni-noticebar__more {
376
- /* #ifndef APP-NVUE */
377
- display: inline-flex;
378
- /* #endif */
379
- flex-direction: row;
380
- flex-wrap: nowrap;
381
- align-items: center;
382
- padding-left: 5px;
383
- }
384
-
385
- .uni-noticebar__more-text {
386
- font-size: 14px;
387
- }
388
-
389
- @keyframes notice {
390
- 100% {
391
- transform: translate3d(-100%, 0, 0);
392
- }
393
- }
394
- </style>