bug: 关闭条形码窗口时清空数据
This commit is contained in:
parent
8ebf15cdc4
commit
c9537f5f04
@ -80,10 +80,10 @@
|
||||
title="条形码打印"
|
||||
width="100%"
|
||||
wrap-class-name="full-modal"
|
||||
@ok="openPrint = false"
|
||||
@cancel="openPrint = false"
|
||||
@ok="closePrint"
|
||||
@cancel="closePrint"
|
||||
>
|
||||
<printCode :material-id="materialIdRef"></printCode>
|
||||
<printCode ref="printcodeRef" :material-id="materialIdRef"></printCode>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
@ -103,6 +103,7 @@
|
||||
const materialPage = ref<IPage<material.Material>>()
|
||||
const loading = ref(false)
|
||||
const materialIdRef = ref<number>()
|
||||
const printcodeRef = ref()
|
||||
|
||||
// 加载数据的方法
|
||||
const loadData = async (page = 1, size = 10) => {
|
||||
@ -233,10 +234,17 @@
|
||||
})
|
||||
}
|
||||
|
||||
// 打开打印弹窗
|
||||
const showPrintModal = (applyId: number) => {
|
||||
openPrint.value = true
|
||||
materialIdRef.value = applyId
|
||||
}
|
||||
|
||||
// 关闭打印弹窗
|
||||
const closePrint = () => {
|
||||
openPrint.value = false
|
||||
printcodeRef.value.clearContent()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
@ -27,6 +27,13 @@
|
||||
default: 0,
|
||||
},
|
||||
})
|
||||
const clearContent = () => {
|
||||
inputRef.value = 0
|
||||
const container = document.getElementById('barcodes-container')
|
||||
if (container) container.innerHTML = ''
|
||||
}
|
||||
// 向父组件暴露清空条形码容器的函数
|
||||
defineExpose({ clearContent })
|
||||
|
||||
const inputRef = ref(0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user