更新记录
1.0.1(2024-04-12)
增加设备支持与NFC启用判断
1.0.0(2024-04-12)
提交插件
平台兼容性
Vue2 | Vue3 |
---|---|
√ | √ |
App | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ小程序 |
---|---|---|---|---|---|---|
Android:4.4,iOS:不支持 | × | × | × | × | × | × |
钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |
---|---|---|---|
× | × | × | × |
H5-Safari | Android Browser | 微信浏览器(Android) | QQ浏览器(Android) | Chrome | IE | Edge | Firefox | PC-Safari |
---|---|---|---|---|---|---|---|---|
× | × | × | × | × | × | × | × | × |
read-nfc
开发文档
UTS 语法 UTS API插件 UTS 组件插件 Hello UTS
使用了NFC的Android原生库需要打包使用自定义基座
引入插件对象
import * as nfc from "@/uni_modules/read-nfc";
调起NFC识别
data() {
return {
title: '读取NFC监听',
nfcCode:''
}
},
onLoad() {
this.gotoNfcActivity();//调起NFC识别,并监听回调
},
methods: {
gotoNfcActivity() {
let that=this;
nfc.gotoNfcActivity(function(result){
that.nfcCode=result.message;
uni.showModal({
title: '提示',
content: result.message,
confirmText:'继续',
success: function (res) {
if (res.confirm) {
that.gotoNfcActivity();//继续识别
console.log('用户点击继续!');
} else if (res.cancel) {
console.log('用户点击取消!');
}
}
});
console.log('NFC',result);
});
}
}