更新记录
1.0.10(2026-01-08)
增加类型导出
1.0.9(2026-01-07)
代码重构,增加支持鸿蒙平台
1.0.8(2025-07-22)
修复uniapp x打包报错,AndroidManifest.xml 需要显式声明 android:exported="true"
查看更多平台兼容性
uni-app(4.81)
| Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
|---|---|---|---|---|---|---|---|---|
| - | - | × | × | - | - | 5.0 | × | √ |
| 微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
|---|---|---|---|---|---|---|---|---|---|---|
| × | × | × | × | × | × | × | × | × | × | × |
uni-app x(4.81)
| Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
|---|---|---|---|---|---|
| × | × | 5.0 | × | - | × |
read-nfc
插件示例
1、通过插件市场“使用 HBuilderX 导入示例项目”下载插件示例项目
2、通过插件市场“试用”导入插件到示例项目中
3、打包并运行自定义基座
本插件使用了原生能力需要打包自定义基座并真机运行(鸿蒙端可以直接本地运行)
引入插件对象
import * as nfc from "@/uni_modules/read-nfc";
演示界面
<template>
<view class="content">
<view style="display: flex; width: 100%;">
<view style="border: solid 1px #CCC; border-radius: 5px; margin:10px; padding: 10px; width: 100%; height: 200px;">
<text>NFC卡号:{{nfcCode}}</text>
</view>
</view>
<view style="display: flex; justify-content: center;">
<button type="primary" @click="startReadNfc">开始读取NFC</button>
<button type="primary" style="margin-left: 10px;" @click="stopReadNfc">停止读取NFC</button>
</view>
</view>
</template>
调起NFC识别
export default {
data() {
return {
nfcCode:''
}
},
onLoad() {
// this.startReadNfc();
},
onHide() {
this.stopReadNfc()
},
methods: {
startReadNfc() {
let that=this;
nfc.startReadNfc(function(result){
that.nfcCode = result.data.uid;
console.log('NFC',result);
});
//uniapp x
//nfc.startReadNfc((result:nfc.MsgOption) => {
// let res:UTSJSONObject=result.data!;
// that.nfcCode = res['uid'] as String;
// console.log('NFC',result);
//});
},
stopReadNfc(){
//仅鸿蒙平台,Android平台关闭界面限停止
// #ifdef APP-HARMONY
nfc.stopReadNfc();
// #endif
}
}
}

收藏人数:
购买源码授权版(
试用
使用 HBuilderX 导入示例项目
赞赏(1)
下载 14281
赞赏 3
下载 13049361
赞赏 1841
赞赏
京公网安备:11010802035340号