42 lines
870 B
Vue
42 lines
870 B
Vue
<template>
|
|
<view class="zd_container">
|
|
<nav-bar :title="title"></nav-bar>
|
|
<view class="zd_content">
|
|
<text>RFID Data: {{ rfidData }}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import NavBar from '@/components/NavBar.vue'
|
|
import { initRfidScan } from '@/utils/rfid.js'
|
|
export default {
|
|
components: {
|
|
NavBar
|
|
},
|
|
data() {
|
|
return {
|
|
rfidData: '', // 存储接收到的 RFID 数据
|
|
unregisterRfid: null, // 声明 unregisterRfid 属性
|
|
}
|
|
},
|
|
onLoad (options) {
|
|
this.title = options.title
|
|
},
|
|
onShow() {
|
|
// 初始化 RFID 扫描
|
|
this.unregisterRfid = initRfidScan((data) => {
|
|
this.rfidData = data.rfidEpc; // 更新页面数据
|
|
});
|
|
},
|
|
onHide() {
|
|
// 注销 RFID 扫描
|
|
if (this.unregisterRfid) {
|
|
this.unregisterRfid();
|
|
this.unregisterRfid = null;
|
|
}
|
|
},
|
|
methods: {
|
|
}
|
|
}
|
|
</script> |