Vue调用Android的方法
1、在vue页面中自己写个按钮,通过点击按钮来调用Android封装好的方法。<template><div><button @click="scan()">点击</button></div></template>2、点击时咱们给安卓传个参数,安卓定义好参数类型。export default {name: 'home',data
·
1、在vue页面中自己写个按钮,通过点击按钮来调用Android封装好的方法。
<template>
<div>
<button @click="scan()">点击</button>
</div>
</template>
2、点击时咱们给安卓传个参数,安卓定义好参数类型。
export default {
name: 'home',
data () {
return {
arr:'123' //给安卓传参数,安卓需要定义参数类型
}
},
methods:{
scan: function(arr) {
window.android.takePhoto(this.arr);
//takePhoto()是安卓定义好的方法
}
}
}
3、ojbk
更多推荐
已为社区贡献3条内容
所有评论(0)