DingTalk micro-app - - - - - How to open an external browser

When the DingTalk micro-app is started, the embedded browser is used to open it by default.

What if you want to open it externally?

1. Official example

Of course, the official has given the corresponding API: 【biz.util.openLink】

The specific use is as follows:

dd.biz.util.openLink({
    
    
    url:"https://open.dingtalk.com/",//要打开链接的地址
    onSuccess : function(result) {
    
    
        /**/
    },
    onFail : function(err) {
    
    }
})

2. My practice

<template>
  <div class="full tips-center">{
   
   {tips}}</div>
</template>
<script>
export default {
      
      
  data() {
      
      
    return {
      
      
      tips: "正在打开外部浏览器..."
    };
  },
  mounted() {
      
      
    const _this = this;
    dd.biz.util.openLink({
      
      
      url: "https://open.dingtalk.com", //要打开链接的地址
      onSuccess: function(result) {
      
      
        _this.tips = "已打开外部浏览器";
      },
      onFail: function(err) {
      
      
        _this.tips = "打开外部浏览器失败";
      }
    });
  }
};
</script> 
<style lang="scss" scoped>
.tips-center {
      
      
  line-height: 100vh;
  text-align: center;
}
</style>

3. Implement the logic

  1. Create a DingTalk micro-app and open the specified page in the project
  2. When pinning the page after opening, call the api to operate

Guess you like

Origin blog.csdn.net/Dark_programmer/article/details/130150697