uview-plus 3.3.14 → 3.3.15

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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## 3.3.15(2024-08-09)
2
+ fix: 修复默认单位设置为rpx时一些组件高度间距异常
3
+
4
+ fix: 修复日历在rpx单位下布局异常
5
+
6
+ feat: code-input支持App端展示输入光标
7
+
1
8
  ## 3.3.14(2024-08-09)
2
9
  add: 增加box组件
3
10
 
@@ -158,13 +158,13 @@
158
158
  const dayWidth = Number(parseFloat(this.width / 7).toFixed(3).slice(0, -1))
159
159
  // 得出每个日期的宽度
160
160
  // #ifdef APP-NVUE
161
- style.width = addUnit(dayWidth)
161
+ style.width = addUnit(dayWidth, 'px')
162
162
  // #endif
163
163
  style.height = addUnit(this.rowHeight)
164
164
  if (index2 === 0) {
165
165
  // 获取当前为星期几,如果为0,则为星期天,减一为每月第一天时,需要向左偏移的item个数
166
166
  week = (week === 0 ? 7 : week) - 1
167
- style.marginLeft = addUnit(week * dayWidth)
167
+ style.marginLeft = addUnit(week * dayWidth, 'px')
168
168
  }
169
169
  if (this.mode === 'range') {
170
170
  // 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug
@@ -23,8 +23,13 @@
23
23
  v-if="mode === 'line'"
24
24
  :style="[lineStyle]"
25
25
  ></view>
26
- <!-- #ifndef APP-PLUS -->
27
- <view v-if="isFocus && codeArray.length === index" :style="{backgroundColor: color}" class="u-code-input__item__cursor"></view>
26
+ <!-- #ifndef APP-NVUE -->
27
+ <view v-if="isFocus && codeArray.length === index"
28
+ :style="{backgroundColor: color}" class="u-code-input__item__cursor"></view>
29
+ <!-- #endif -->
30
+ <!-- #ifdef APP-NVUE -->
31
+ <view v-if="isFocus && codeArray.length === index"
32
+ :style="{backgroundColor: color, opacity: opacity}" class="u-code-input__item__cursor"></view>
28
33
  <!-- #endif -->
29
34
  </view>
30
35
  <input
@@ -79,22 +84,51 @@
79
84
  data() {
80
85
  return {
81
86
  inputValue: '',
82
- isFocus: this.focus
87
+ isFocus: this.focus,
88
+ timer: null,
89
+ opacity: 1
83
90
  }
84
91
  },
85
92
  watch: {
86
93
  // #ifdef VUE2
87
94
  value: {
95
+ immediate: true,
96
+ handler(val) {
97
+ // 转为字符串,超出部分截掉
98
+ this.inputValue = String(val).substring(0, this.maxlength)
99
+ }
100
+ },
88
101
  // #endif
89
102
  // #ifdef VUE3
90
103
  modelValue: {
91
- // #endif
92
104
  immediate: true,
93
105
  handler(val) {
94
106
  // 转为字符串,超出部分截掉
95
107
  this.inputValue = String(val).substring(0, this.maxlength)
96
108
  }
97
109
  },
110
+ // #endif
111
+ isFocus: {
112
+ handler(val) {
113
+ // #ifdef APP-NVUE
114
+ if (val) {
115
+ this.timer = setInterval(() => {
116
+ this.opacity = Math.abs(this.opacity - 1)
117
+ }, 600)
118
+ } else {
119
+ clearInterval(this.timer)
120
+ }
121
+ // #endif
122
+ }
123
+ }
124
+ },
125
+ created() {
126
+
127
+ },
128
+ beforeUnmount() {
129
+ // #ifdef APP-NVUE
130
+ clearInterval(this.timer)
131
+ // #endif
98
132
  },
99
133
  computed: {
100
134
  // 根据长度,循环输入框的个数,因为头条小程序数值不能用于v-for
@@ -188,7 +222,7 @@
188
222
  <style lang="scss" scoped>
189
223
  @import "../../libs/css/components.scss";
190
224
  $u-code-input-cursor-width: 1px;
191
- $u-code-input-cursor-height: 40%;
225
+ $u-code-input-cursor-height: 20px;
192
226
  $u-code-input-cursor-animation-duration: 1s;
193
227
  $u-code-input-cursor-animation-name: u-cursor-flicker;
194
228
 
@@ -223,18 +257,18 @@
223
257
  width: 40px;
224
258
  background-color: $u-content-color;
225
259
  }
226
- /* #ifndef APP-PLUS */
227
260
  &__cursor {
228
261
  position: absolute;
262
+ /* #ifndef APP-NVUE */
229
263
  top: 50%;
230
264
  left: 50%;
265
+ opacity: 1;
231
266
  transform: translate(-50%,-50%);
267
+ /* #endif */
232
268
  width: $u-code-input-cursor-width;
233
269
  height: $u-code-input-cursor-height;
234
270
  animation: $u-code-input-cursor-animation-duration u-cursor-flicker infinite;
235
271
  }
236
- /* #endif */
237
-
238
272
  }
239
273
 
240
274
  &__input {
@@ -249,7 +283,7 @@
249
283
  }
250
284
  }
251
285
 
252
- /* #ifndef APP-PLUS */
286
+ /* #ifndef APP-NVUE */
253
287
  @keyframes u-cursor-flicker {
254
288
  0% {
255
289
  opacity: 0;
@@ -181,8 +181,11 @@ export function addUnit(value = 'auto', unit = '') {
181
181
  if (!unit) {
182
182
  unit = config.unit || 'px'
183
183
  }
184
+ if (unit == 'rpx') {
185
+ value = value * 2
186
+ }
184
187
  value = String(value)
185
- // 用uView内置验证规则中的number判断是否为数值
188
+ // 用内置验证规则中的number判断是否为数值
186
189
  return testNumber(value) ? `${value}${unit}` : value
187
190
  }
188
191
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-plus",
3
3
  "name": "uview-plus",
4
4
  "displayName": "uview-plus3.0重磅发布,全面的Vue3移动组件库。",
5
- "version": "3.3.14",
5
+ "version": "3.3.15",
6
6
  "description": "uview-plus已兼容vue3,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
7
7
  "keywords": [
8
8
  "uview",