做seo的网站推广,上海最出名的编程培训,彩票引流推广方法,设计制作我们的小船小程序登陆后把token和openId 对应传到pc端 pc端有两套一套pc端代码和适应移动端的代码 嵌套的是适应移动端的代码
1.uniapp
templateview classmainu-navbar :fixedtrue :autoBackfalse leftClickgoBacktemplateview classmainu-navbar :fixedtrue :autoBackfalse leftClickgoBack/u-navbarweb-view :srcurl messagemessage/web-view/view
/template
scriptexport default {data() {return {url: ,token: ,canBack: false,openId: }},onLoad() {this.token uni.getStorageSync(token);this.openId uni.getStorageSync(openid);this.url http://192.168.31.190:8888/mobile/?token encodeURIComponent(this.token) openId encodeURIComponent(this.openId)console.log(this.url)},methods: {message(event) {console.log(event.detail.data);},},}
/script
style.main {width: 100%;height: 100vh;}
/style2.vue3vant pc端接收参数
const token ref()
const openId ref()
onMounted(() {var url window.location.href;console.log(url)var regex /[?]token([^#])/; // 匹配 ? 或 后面跟 token 开头的部分var regexId /[?]openId([^#])/; // 匹配 ? 或 后面跟 token 开头的部分var match url.match(regex);token.value decodeURIComponent(match[1]);openId.value decodeURIComponent(url.match(regexId)[1]);
})