const adapter = wx.getNFCAdapter();
adapter.startDiscovery({
success() {
console.log('📡 NFC 监听启动');
}
});
adapter.onDiscovered(async (res) => {
console.log('🧾 NFC 卡片信息:', res);
if (!res.techs.includes('NFC-A')) {
console.warn('该卡不支持 NFC-A');
return;
}
const nfcA = adapter.getNfcA(); // 💡 获取 NfcA 实例
console.log('nfcA:', nfcA); // 应有 connect、transceive 方法
if (!nfcA || typeof nfcA.connect !== 'function') {
wx.showToast({ title: 'NfcA 无效', icon: 'none' });
return;
} 现在只能读取到卡类型,但是卡信息两个方法都没有返回,为什么
