同步web端组件到企微

This commit is contained in:
aixianling
2022-07-21 11:19:08 +08:00
parent 074fee775d
commit 4f77b3280f
2 changed files with 37 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div :type="type" :openid="oid"/>
<div class="AiOpenData" :type="type" :openid="oid"/>
</template>
<script>
@@ -17,31 +17,15 @@ export default {
}
},
methods: {
...mapActions(['injectJWeixin']),
bindWWOpenData() {
window?.WWOpenData?.checkSession({
success: () => {
WWOpenData.bind(this.$el)
},
fail: () => {
this.injectJWeixin().then(() => {
WWOpenData.bind(this.$el)
})
}
}) || this.injectJWeixin().then(() => {
WWOpenData.bind(this.$el)
})
}
...mapActions(['initOpenData']),
},
watch: {
openid(v) {
v && this.bindWWOpenData()
openid: {
handler(v) {
v && this.initOpenData()
},
immediate: true
}
},
mounted() {
this.$nextTick(() => {
this.bindWWOpenData()
})
}
}
</script>