Component({
options: {
styleIsolation: "apply-shared",
},
lifetimes: {
attached() {
},
},
methods: {
handlePan(evt) {
'worklet';
if (evt.state === GestureState.CANCELLED) {
wx.worklet.runOnJS(this.openChat.bind(this))();
}
},
openChat() {
wx.showToast({ title: '测试' });
wx.openCustomerServiceChat({
extInfo: { url: "https://work.weixin.qq.com/kfid/xxxxx" },
corpId: 'xxxxx',
});
}
}
});
// skyline 模式下,调会JS线程执行openChat时,showToast 能正常运行,但是 openCustomerServiceChat 没有响应
// webview 模式下,直接给节点绑定click事件,openCustomerServiceChat 可以正常调用
是因为需要在点击回调里才能调用,你这里具体是想做成什么样的交互
wxml的代码如下:
<pan-gesture-handler on-gesture-event="handlePan">
<image src="" />
</pan-gesture-handler>
这样的话还有办法调用openCustomerServiceChat 吗?
你好,麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点
问题解决了,在 pan-gesture-handler 外再包一层view,给view 绑定 tap事件来触发openChat
<view bindtap="openChat"> <pan-gesture-handler on-gesture-event="handlePan"> <image src="" /> </pan-gesture-handler> </view>