//读取NFC标签
readNFC(){
let app = this;
wx.nfc = wx.getNFCAdapter();
wx.nfc.startDiscovery({
success: (res) => {
console.log('NFC发现成功', res);
wx.nfc.onDiscovered((res) => {
app.$modal.alert('res',JSON.stringify(res))
app.$modal.alert('res.messages[0]',JSON.stringify(res))
const nfcData = res.messages[0];
app.nfcData=nfcData;
}
);
},
fail: (err) => {
console.error('NFC发现失败', err);
wx.showToast({
title: 'NFC发现失败',
icon: 'none'
});
}
});
},
打印的数据{"records":[{"tnf":2,"type":{},"id"{},"payload":{}}]}