onLoad(options) {
//进来可以判断角色
this.getStepCode()
if(!options.id){
let wwwurl = decodeURIComponent(options.q)
this.id=wwwurl.split('?id=')[1];
} else {
this.id = options.id
}
this.getList(this.id)
this.userId= uni.getStorageSync('userId')
if(this.userId==''||this.userId==null||this.userId==undefined){
this.sysUserId= false
} else {
this.sysUserId= true
}
},
对获取到的路径进行截取
let wwwurl = decodeURIComponent(options.q)
this.id=wwwurl.split(‘?id=’)[1];
本文详细描述了JavaScript中onLoad函数的使用,涉及角色判断、URL参数提取、用户ID获取以及本地存储管理。特别关注了如何从URL中截取id参数并处理用户权限问题。
988

被折叠的 条评论
为什么被折叠?



