wui-components-v2 1.2.69 → 1.2.70

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.
@@ -260,11 +260,7 @@ function detail() {
260
260
  props.detailButtonHandle(props.data)
261
261
  return
262
262
  }
263
- router.push(
264
- `/pages/details-page/index?sourceId=${encodeURIComponent(props.sourceId)}&id=${encodeURIComponent(
265
- props.code
266
- )}&title=${encodeURIComponent(props.item.title || '')}`
267
- )
263
+ router.push(`/pages/details-page/index?sourceId=${props.sourceId}&id=${props.code}&title=${props.item.title}`)
268
264
  }
269
265
 
270
266
  // 判断按钮是否满足条件显示
@@ -98,22 +98,19 @@ function goDetail(item: Columns) {
98
98
  .map(param => {
99
99
  const fieldValue = props.data.fieldMap[param.id]
100
100
  const value = fieldValue ?? param.defaultValue ?? ''
101
- return `${encodeURIComponent(param.title ?? '')}=${encodeURIComponent(String(value))}`
101
+ return `${param.title ?? ''}=${value}`
102
102
  })
103
103
  .join('&')
104
104
  const sep = params ? (fieldJump.mobilePath.includes('?') ? '&' : '?') : ''
105
- // 对完整 URL 编码,避免 mobilePath 中的中文/全角字符在 H5 hash 路由下解析错乱
105
+ // 明文拼接;encodeURI 仅编码空格等 URL 非法字符,接收端(wui-list 等)解码一次还原
106
106
  uni.navigateTo({
107
107
  url: encodeURI(`${fieldJump.mobilePath}${sep}${params}`),
108
108
  })
109
109
  return
110
110
  }
111
- // 使用字段自身的 sourceId(参考 w-card.vue goto('link'))
112
- // 参数统一 encodeURIComponent,避免中文/特殊字符在 App 端被截断导致乱码、参数错位
111
+ // 使用字段自身的 sourceId(参考 w-card.vue goto('link')),明文拼接,不手动编码
113
112
  uni.navigateTo({
114
- url: `/pages/details-page/index?sourceId=${encodeURIComponent(item.sourceId)}&id=${encodeURIComponent(
115
- String(code)
116
- )}&title=${encodeURIComponent(item.title || '')}`,
113
+ url: `/pages/details-page/index?sourceId=${item.sourceId}&id=${code}&title=${item.title || ''}`,
117
114
  })
118
115
  }
119
116
  </script>
@@ -59,24 +59,16 @@ const loading = ref(false)
59
59
  // 折叠面板
60
60
  const collapses = ref()
61
61
  /**
62
- * 安全解码:循环解码直到字符串不再变化或解码失败。
63
- * 各端 uni.navigateTo 对 URL 参数值的编码次数不一致(H5/App 会在跳转端
64
- * encodeURIComponent 的基础上再自动编码一次,onLoad 收到双重编码值),
65
- * 这里循环解码到稳定态,兼容 0/1/2 层编码,保证拿到明文。
62
+ * 简单解码:跳转端明文传参,URL 传输时浏览器/App 框架会自动编码一层,
63
+ * 接收端解一次即可还原明文。已解码的值(无 % 或解码抛错)原样返回。
66
64
  */
67
65
  function safeDecode(value?: string): string {
68
66
  if (!value) return ''
69
- let result = value
70
- while (result.includes('%')) {
71
- try {
72
- const decoded = decodeURIComponent(result)
73
- if (decoded === result) break
74
- result = decoded
75
- } catch {
76
- break
77
- }
67
+ try {
68
+ return decodeURIComponent(value)
69
+ } catch {
70
+ return value
78
71
  }
79
- return result
80
72
  }
81
73
  onLoad((option: any) => {
82
74
  sourceId.value = safeDecode(option.sourceId)
@@ -390,24 +390,16 @@ async function batchAction(item: rowActions) {
390
390
  // 优先使用 props 传入的 sourceId,未传则走 onLoad 路由获取
391
391
  const internalSourceId = ref(props.sourceId)
392
392
  /**
393
- * 安全解码:循环解码直到字符串不再变化或解码失败。
394
- * 各端 uni.navigateTo 对 URL 参数值的编码次数不一致(H5/App 会在跳转端
395
- * encodeURIComponent 的基础上再自动编码一次,onLoad 收到双重编码值),
396
- * 这里循环解码到稳定态,兼容 0/1/2 层编码,保证拿到明文。
393
+ * 简单解码:跳转端明文传参,URL 传输时浏览器/App 框架会自动编码一层,
394
+ * 接收端解一次即可还原明文。已解码的值(无 % 或解码抛错)原样返回。
397
395
  */
398
396
  function safeDecode(value?: string | number): string {
399
397
  if (value === undefined || value === null) return ''
400
- let result = String(value)
401
- while (result.includes('%')) {
402
- try {
403
- const decoded = decodeURIComponent(result)
404
- if (decoded === result) break
405
- result = decoded
406
- } catch {
407
- break
408
- }
398
+ try {
399
+ return decodeURIComponent(String(value))
400
+ } catch {
401
+ return String(value)
409
402
  }
410
- return result
411
403
  }
412
404
  onLoad((option: any) => {
413
405
  // 如果 props 没传 sourceId,则从路由参数获取
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.69",
3
+ "version": "1.2.70",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",