if (JSON.stringify(option) !== '{}' && option.scene !== undefined) { let scene = decodeURIComponent(option.scene); let sceneData = {}; scene.split( '&' ).forEach(item => { sceneData[item.split( '=' )[0]] = (item.split( '=' )[1]); }) console.log( 'scene' , sceneData); } |
mark
nb
let getQueryString = {}
let strs = decodeURIComponent(options.scene).split('&') //以&分割
//取得全部并赋值
for (var i = 0; i < strs.length; i++) {
getQueryString[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
}
this.setData({
partJobId: getQueryString['partJobId']
})
可以直接用云调用了,