收藏
回答

读取NFC标签数据为空数据?

  //读取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":{}}]}

回答关注问题邀请回答
收藏
登录 后发表内容