收藏
回答

wx.getNFCAdapter.onDiscovered方法里没有tag参数,为什么?

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;

      } 现在只能读取到卡类型,但是卡信息两个方法都没有返回,为什么

回答关注问题邀请回答
收藏

2 个回答

  • hushnow.
    hushnow.
    06-04
    nfcA.connect()没有返回这个方法
    
    
    06-04
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    06-04
    有用
登录 后发表内容