applets-patch.js
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {
appPlatform
} from '../helpers/util.js'
import {
Global
} from "../helpers/config.js";
export const queryInfo = function (Vim) {
let query = {};
Vim.query = Vim.query || {}; //计算属性中query会丢失 https://github.com/SilurianYang/uni-simple-router/issues/26
if(Global.Router.CONFIG.encodeURI){
if (Vim.ONLAUNCH == null) {
try {
query = JSON.parse(decodeURIComponent(Vim.query.query || encodeURIComponent('{}')))
} catch (e) {
query = JSON.parse(Vim.query.query)
}
}
}else{
query=Vim.query;
}
let path = '';
let ruleKey='path';
switch (appPlatform()) {
case 'H5':
path = Vim.page &&( ruleKey='aliasPath',Vim.page.$page.path || '/' + Vim.page.route);
break;
case 'BAIDU':
path = '/' + Vim.page.pageinstance.route || '';
break
default:
path = '/' + Vim.page.route || '';
break;
}
const route={}
route[ruleKey]=path;
return {
route,
ruleKey,
query
}
}
/**
* 截止 1.3.5 版本 不做任何操作
* @param {element} el dom节点
*/
export const appletsMount=function(Vim,el){
Vim.$mount();
}