新增 WarehouseBird 和 WarehouseGrid 组件实现仓库库位可视化展示 添加 QRCode 组件用于生成库位二维码 实现库位初始化功能,支持批量生成库位 优化库位展示,支持行列转置和详情查看 修复部分显示字段名称问题
50 lines
791 B
Vue
50 lines
791 B
Vue
<template>
|
|
<canvas ref="qrcode"></canvas>
|
|
</template>
|
|
|
|
<script>
|
|
import QRCode from 'qrcode';
|
|
|
|
export default {
|
|
name: 'QRCode',
|
|
props: {
|
|
content: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
size: {
|
|
type: Number,
|
|
default: 90
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
qrcode: null
|
|
}
|
|
},
|
|
watch: {
|
|
content: {
|
|
handler(newVal, oldVal) {
|
|
if (newVal !== oldVal) {
|
|
this.generateQRCode();
|
|
}
|
|
},
|
|
immediate: true
|
|
}
|
|
},
|
|
mounted() {
|
|
this.generateQRCode();
|
|
},
|
|
methods: {
|
|
generateQRCode() {
|
|
const el = this.$refs.qrcode;
|
|
const content = this.content;
|
|
QRCode.toCanvas(el, content, {
|
|
width: this.size,
|
|
height: this.size,
|
|
margin: 0
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script> |