小程序:
<template>
<view>
<web-view v-if="webUrl" :src="webUrl"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
webUrl: "",
token: "",
};
},
onLoad() {
this.token = uni.getStorageSync('userInfo').token
this.webUrl = "https://dd.ycsmes.com/h5?wx=1&token=" + this.token
console.log(this.webUrl);
},
};
</script>
H5
app.vue中动态引入微信JSSDK,直接在页面中引入会出现wx.miniProgram为undefined (坑了我好久)
onLaunch(e) {
var script = document.createElement('script')
script.src = "https://res.wx.qq.com/open/js/jweixin-1.6.0.js"
script.type = 'text/javascript';
document.body.appendChild(script)
},
在需要进行返回操作的页面
wx.miniProgram.navigateBack()