vue调用andriod方法


 methods: {
    isAndroid() {                    //判断机型是android
      const u = navigator.userAgent;
      const isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //判断android
      return isAndroid;
    },
    totongxunlu() {    
      this.isAndroid();                  //调用判断是android的方法
      if (this.isAndroid()) {          
        android.intent2Im(  //如果是android,调用android方法,写法 android.方法名(需要传的参数)
          this.$cookies.get('imuserid').toString(),
          this.$cookies.get('imnickname').toString(),
          this.$cookies.get('imavatar').toString()
        ); //点击跳转通讯录
      }
    },
    tocamera(){
      android.intent2Scan()         点击事件调用android方法
    },
}
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM