w-ui-v1 1.0.41 → 1.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -35,11 +35,38 @@ const pageData = ref([])
35
35
  const pageConf = ref({ groups: [] })
36
36
 
37
37
  onLoad((option: any) => {
38
- sourceId.value = props.sourceId || option.sourceId
39
- code.value = option.code || props.code
38
+ const q = decodeURIComponent(option.q) // 获取到二维码原始链接内容
39
+ let sc:any=getQueryParams(q)
40
+ sourceId.value = props.sourceId || option.sourceId ||sc.sourceId
41
+ code.value = option.code || props.code || sc.code
40
42
  getPageData()
41
43
  uni.setNavigationBarTitle({ title: "详情" })
42
44
  })
45
+
46
+ //将 URL 中问号后面的参数转换为对象
47
+ function getQueryParams(url:string) {
48
+ // 获取问号后面的部分
49
+ const queryString = url.split('?')[1];
50
+
51
+ if (!queryString) {
52
+ return {};
53
+ }
54
+
55
+ // 将参数字符串分割成键值对数组
56
+ const pairs = queryString.split('&');
57
+
58
+ // 创建结果对象
59
+ const result = {};
60
+
61
+ // 遍历键值对
62
+ pairs.forEach(pair => {
63
+ const [key, value] = pair.split('=');
64
+ // 解码URI组件并添加到结果对象
65
+ result[decodeURIComponent(key)] = decodeURIComponent(value || '');
66
+ });
67
+
68
+ return result;
69
+ }
43
70
  // 获取页面配置
44
71
  function getPageConfig() {
45
72
  detailPageConfig(sourceId.value).then((res: any) => {