**

1.1.控制浏览器返回(区分安卓和苹果(兼容性))

**
import * as dd from ‘dingtalk-jsapi’
mounted{
const u = navigator.userAgent
const isiOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/)
if (!isiOS) { // 控制androw端的返回
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL)
window.addEventListener(‘popstate’, this.goBack, false)
}
} else { // 控制ios端的返回
const that = this
if (this.isInDingTalk) {
this.util.setNavbarTitle(‘已发送的报价单’)
dd.biz.navigation.setLeft({
control: true,
onSuccess: function () {
that.goBack()
}
})
}
}
}
//离开销毁:
destroyed () {
window.removeEventListener(‘popstate’, this.goBack, false)
},

1.2.vue控制退出钉钉微应用:

dd.ready(function() {
document.addEventListener(‘popstate’, function(e) {
// 在这里处理你的业务逻辑
e.preventDefault();
dd.biz.navigation.close({
onSuccess : function(result) {
alert(JSON.stringify(result));
},
onFail : function(err) {}
})
});

Logo

前往低代码交流专区

更多推荐