wui-components-v2 1.0.60 → 1.0.61
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.
|
@@ -43,6 +43,12 @@ const collapses = ref()
|
|
|
43
43
|
onLoad((option: any) => {
|
|
44
44
|
sourceId.value = option.sourceId
|
|
45
45
|
id.value = option.id
|
|
46
|
+
// #ifdef MP-WEIXIN
|
|
47
|
+
const q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
|
|
48
|
+
const sc: any = getQueryParams(q)
|
|
49
|
+
sourceId.value = sc.sourceId
|
|
50
|
+
id.value = sc.id
|
|
51
|
+
// #endif
|
|
46
52
|
title.value = option.title
|
|
47
53
|
uni.setNavigationBarTitle({
|
|
48
54
|
title: `${option.title}`,
|
|
@@ -50,6 +56,31 @@ onLoad((option: any) => {
|
|
|
50
56
|
getPageConfig()
|
|
51
57
|
})
|
|
52
58
|
|
|
59
|
+
// 将 URL 中问号后面的参数转换为对象
|
|
60
|
+
function getQueryParams(url: string) {
|
|
61
|
+
// 获取问号后面的部分
|
|
62
|
+
const queryString = url.split('?')[1]
|
|
63
|
+
|
|
64
|
+
if (!queryString) {
|
|
65
|
+
return {}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 将参数字符串分割成键值对数组
|
|
69
|
+
const pairs = queryString.split('&')
|
|
70
|
+
|
|
71
|
+
// 创建结果对象
|
|
72
|
+
const result: { [key: string]: string } = {}
|
|
73
|
+
|
|
74
|
+
// 遍历键值对
|
|
75
|
+
pairs.forEach((pair) => {
|
|
76
|
+
const [key, value] = pair.split('=')
|
|
77
|
+
// 解码URI组件并添加到结果对象
|
|
78
|
+
result[decodeURIComponent(key)] = decodeURIComponent(value || '')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
return result
|
|
82
|
+
}
|
|
83
|
+
|
|
53
84
|
// 获取页面配置
|
|
54
85
|
async function getPageConfig() {
|
|
55
86
|
try {
|
|
@@ -57,6 +88,9 @@ async function getPageConfig() {
|
|
|
57
88
|
const res = await detailPageConfig(sourceId.value)
|
|
58
89
|
// 初始化折叠面板
|
|
59
90
|
if (res.dtmplConfig) {
|
|
91
|
+
uni.setNavigationBarTitle({
|
|
92
|
+
title: `${res.dtmplConfig.title}`,
|
|
93
|
+
})
|
|
60
94
|
pageConfig.value = res.dtmplConfig
|
|
61
95
|
collapses.value = pageConfig.value.groups.map((item: Groups) => {
|
|
62
96
|
return item.id
|