优化表单构建关闭页签销毁复制插件

This commit is contained in:
RuoYi
2025-12-04 13:03:38 +08:00
parent b086e172ae
commit d2b4332589

View File

@@ -295,8 +295,9 @@ watch(activeId, (val) => {
oldActiveId = val
}, { immediate: true })
let clipboard = null
onMounted(() => {
const clipboard = new ClipboardJS('#copyNode', {
clipboard = new ClipboardJS('#copyNode', {
text: trigger => {
const codeStr = generateCode()
ElNotification({ title: '成功', message: '代码已复制到剪切板,可粘贴。', type: 'success' })
@@ -307,6 +308,9 @@ onMounted(() => {
proxy.$modal.msgError('代码复制失败')
})
})
onUnmounted(() => {
clipboard.destroy()
})
</script>
<style lang='scss'>