uview-ultra 4.5.71 → 4.5.74

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.
@@ -67,7 +67,7 @@
67
67
  >{{ message }}</text>
68
68
  </slot>
69
69
  <up-line
70
- v-if="borderBottom"
70
+ v-if="resolvedBorderBottom"
71
71
  :color="message != '' && parentData['errorType'] == 'border-bottom' ? color['error'] : propsLine['color']"
72
72
  :customStyle="`margin-top: ${message != '' && parentData['errorType'] == 'message' ? '5px' : 0}`"
73
73
  ></up-line>
@@ -93,6 +93,8 @@
93
93
  labelWidth: 45,
94
94
  // 错误提示方式
95
95
  errorType: 'message',
96
+ // 是否显示下划线边框,未在up-form-item上显式设置时跟随up-form的同名属性
97
+ borderBottom: true,
96
98
  originalModel: {}
97
99
  })
98
100
  const instance = getCurrentInstance()!.proxy!
@@ -178,6 +180,17 @@
178
180
  const message = ref('')
179
181
  const itemRules = ref<UTSJSONObject[]|UTSJSONObject>({})
180
182
 
183
+ // 是否显示下划线边框:未在up-form-item上显式设置(默认空串)时,跟随up-form的同名属性。
184
+ // 此前 form-item 只读自己的 borderBottom,导致 up-form 上配的 borderBottom 完全不生效
185
+ const resolvedBorderBottom = computed((): boolean => {
186
+ const own: any = props.borderBottom
187
+ if (own == null || (typeof own == 'string' && (own as string) == '')) {
188
+ const fromParent: any = parentData.value['borderBottom']
189
+ return fromParent == null ? true : fromParent as boolean
190
+ }
191
+ return own as boolean
192
+ })
193
+
181
194
  // 获取父组件的参数
182
195
  const updateParentData = () => {
183
196
  getParentData('up-form', instance, false);
@@ -67,7 +67,7 @@
67
67
  >{{ message }}</text>
68
68
  </slot>
69
69
  <u-line
70
- v-if="borderBottom"
70
+ v-if="resolvedBorderBottom"
71
71
  :color="message && parentData['errorType'] === 'border-bottom' ? color['error'] : propsLine['color']"
72
72
  :customStyle="`margin-top: ${message && parentData['errorType'] === 'message' ? '5px' : 0}`"
73
73
  ></u-line>
@@ -121,7 +121,9 @@
121
121
  // 提示文本的宽度
122
122
  labelWidth: 45,
123
123
  // 错误提示方式
124
- errorType: 'message'
124
+ errorType: 'message',
125
+ // 是否显示下划线边框,未在up-form-item上显式设置时跟随up-form的同名属性
126
+ borderBottom: true
125
127
  })
126
128
  const { parent, getParentData } = useUltraUI(props, parentData)
127
129
  // 错误提示语
@@ -134,6 +136,16 @@
134
136
  return defProps.line
135
137
  })
136
138
 
139
+ // 是否显示下划线边框:未在up-form-item上显式设置(默认空串)时,跟随up-form的同名属性。
140
+ // 此前 form-item 只读自己的 borderBottom,导致 up-form 上配的 borderBottom 完全不生效
141
+ const resolvedBorderBottom = computed(() => {
142
+ const own = props.borderBottom
143
+ if (own === '' || own === undefined || own === null) {
144
+ return parentData.borderBottom
145
+ }
146
+ return own
147
+ })
148
+
137
149
  function init() {
138
150
  // 父组件的实例
139
151
  updateParentData()
@@ -340,6 +340,10 @@ watch((): any => props.modelValue, (newVal: any, oldVal: string|number) => {
340
340
  if ((changeFromInner.value && !isBlurFormattedValue) || innerValue.value == newVal) {
341
341
  changeFromInner.value = false // 重要否则会出现双向绑定失效问题https://github.com/ijry/uview-plus/issues/419
342
342
  blurValue.value = null
343
+ // immediate 首次执行也会走这里,必须把 firstChange 置为 false,
344
+ // 否则首次外部赋值(如弹窗选择回填)会因 firstChange 仍为 true
345
+ // 而跳过 valueChange 与表单验证
346
+ firstChange.value = false
343
347
  return
344
348
  }
345
349
  innerValue.value = newVal
@@ -167,6 +167,10 @@ watch(() => props.modelValue, (newVal) => {
167
167
  if ((changeFromInner.value && !isBlurFormattedValue) || innerValue.value === newVal) {
168
168
  changeFromInner.value = false // 重要否则会出现双向绑定失效问题https://github.com/ijry/uview-plus/issues/419
169
169
  blurValue.value = null
170
+ // immediate 首次执行也会走这里,必须把 firstChange 置为 false,
171
+ // 否则首次外部赋值(如弹窗选择回填)会因 firstChange 仍为 true
172
+ // 而跳过 valueChange 与表单验证
173
+ firstChange.value = false
170
174
  return
171
175
  }
172
176
  innerValue.value = newVal
@@ -282,7 +286,8 @@ function doFocus() {
282
286
 
283
287
  function doBlur() {
284
288
  const inputNative = proxy?.$refs?.['input-native']
285
- inputNative && inputNative.blur()
289
+ // 部分平台(如小程序端)取不到原生节点引用,做防御性调用避免直接抛错
290
+ inputNative && typeof inputNative.blur === 'function' && inputNative.blur()
286
291
  }
287
292
 
288
293
  // 点击完成按钮时触发
@@ -21,13 +21,19 @@
21
21
  <view
22
22
  class="up-keyboard__button-wrapper"
23
23
  >
24
+ <!--
25
+ 退格键的删除由 @tap 触发;@touchstart 只负责延时进入长按连删。
26
+ 注意:@touchstart 上不能加 .stop(编译成微信小程序的 catchtouchstart 后会吞掉同一节点上的 tap,
27
+ 短按就再也删不掉、只剩长按有效)
28
+ -->
24
29
  <view
25
30
  class="up-keyboard__button-wrapper__button up-keyboard__button-wrapper__button--gray"
26
31
  hover-class="up-hover-class"
27
32
  :hover-stay-time="200"
28
33
  @tap="backspaceClick"
29
- @touchstart.stop="backspaceTouchStart"
34
+ @touchstart="backspaceTouchStart"
30
35
  @touchend="clearTimer"
36
+ @touchcancel="clearTimer"
31
37
  >
32
38
  <up-icon
33
39
  name="backspace"
@@ -21,13 +21,20 @@
21
21
  <view
22
22
  class="up-keyboard__button-wrapper"
23
23
  >
24
+ <!--
25
+ 退格键的删除由 @tap 触发(PC 端浏览器只有鼠标事件,不产生 touch);
26
+ @touchstart 只负责延时进入长按连删,短按时定时器会在 touchend 前被清除,所以不会删两次。
27
+ 注意:@touchstart 上不能加 .stop(编译成微信小程序的 catchtouchstart 后会吞掉同一个节点上的 tap,
28
+ 短按就再也删不掉、只剩长按有效),up-number-box 的加减键同样只绑 bindtouchstart。
29
+ -->
24
30
  <view
25
31
  class="up-keyboard__button-wrapper__button up-keyboard__button-wrapper__button--gray"
26
32
  hover-class="up-hover-class"
27
33
  :hover-stay-time="200"
28
34
  @tap="backspaceClick"
29
- @touchstart.stop="backspaceTouchStart"
35
+ @touchstart="backspaceTouchStart"
30
36
  @touchend="clearTimer"
37
+ @touchcancel="clearTimer"
31
38
  >
32
39
  <up-icon
33
40
  name="backspace"
@@ -11,4 +11,4 @@ export default {
11
11
  toastHost: true,
12
12
  customStyle: {}
13
13
  }
14
- } as UTSJSONObject
14
+ }