更新记录
1.0.0(2024-06-28)
插件上传
平台兼容性
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 5.0 | × | - | × |
laoyu-nfcHelper
开发文档
UTS 语法 UTS API插件 UTS 组件插件 Hello UTS
仅支持安卓端
权限配置
<uses-permission android:name="android.permission.NFC"/>
使用方法
<template>
<view class="page">
<view>{{ cardUID }}</view>
<button @click="readData()">点我读卡</button>
<button @click="stopRead()">停止读卡</button>
</view>
</template>
<script lang="uts" setup>
import { ref } from 'vue';
import * as nfc from '@/uni_modules/laoyu-nfcHelper';
var cardUID = ref('');
function readData(){
nfc.readNFC((e)=>{
console.log(e);
cardUID.value = e;
});
}
function stopRead(){
nfc.disableNFCReaderMode()
}
</script>
<style>
.page{
}
</style>