<template>
<view style="height: 100vh">
<chat bind:queryCallback="getQueryCallback" bind:openWebview="openWebview"
bind:openMiniProgram="openMiniProgram" />
</view>
</template>
<script setup>
import {
reactive,
getCurrentInstance,
ref
} from 'vue'
import {
onReady,
onLoad,
onUnload,
onHide
} from "@dcloudio/uni-app"
let userInfo = ref({})
let plugin = requirePlugin("chatbot");
onLoad((option) => {
userInfo.value = uni.getStorageSync('userInfo');
let userName = ''
if (userInfo.value?.image) {
userName = userInfo.value?.name
}
let userImage = ''
if (userInfo.value?.image_logo) {
userImage = userInfo.value?.image_logo
}
console.log('userInfo.value.openid')
console.log(userInfo.value.openid)
plugin.init({
appid: "我的ID",
openid: userInfo.value.openid,
userHeader: userImage,
userName: userName,
anonymous: false,
success: (res) => {
console.log('res')
console.log(res)
},
fail: (error) => {
console.log('error')
console.log(error)
},
});
})
</script>
<style>
</style>
在pages.json或app.json对面页面路由引入一下自定义组件
走success后还是没跳转到微信客服插件的页面