🐛(component): 修复 upload 组件 drag 属性为 false 时的 removeEventListener 警告

This commit is contained in:
就眠儀式 2022-10-14 10:29:15 +08:00
parent 91f9ee78fa
commit ea112ccb98
2 changed files with 12 additions and 3 deletions

View File

@ -381,7 +381,7 @@ function dragOver(e: any) {
onMounted(() => { onMounted(() => {
nextTick(() => { nextTick(() => {
if(dragRef.value) { if (dragRef.value) {
dragRef.value.addEventListener("dragenter", dragEnter, false); dragRef.value.addEventListener("dragenter", dragEnter, false);
dragRef.value.addEventListener("dragover", dragOver, false); dragRef.value.addEventListener("dragover", dragOver, false);
dragRef.value.addEventListener("drop", uploadChange, false); dragRef.value.addEventListener("drop", uploadChange, false);
@ -390,12 +390,12 @@ onMounted(() => {
}); });
onUnmounted(() => { onUnmounted(() => {
if(dragRef.value) { if (dragRef.value) {
dragRef.value.removeEventListener("dragenter"); dragRef.value.removeEventListener("dragenter");
dragRef.value.removeEventListener("dragover"); dragRef.value.removeEventListener("dragover");
dragRef.value.removeEventListener("drop"); dragRef.value.removeEventListener("drop");
} }
}) });
</script> </script>
<template> <template>

View File

@ -11,6 +11,15 @@
<template> <template>
<lay-timeline> <lay-timeline>
<lay-timeline-item title="1.6.x"> <lay-timeline-item title="1.6.x">
<ul>
<a name="1-6-8"></a>
<li>
<h3>1.6.8 <span class="layui-badge-rim">2022-10-13</span></h3>
<ul>
<li>[修复] upload 组件 drag 为 false 时的 removeEventListener 警告。</li>
</ul>
</li>
</ul>
<ul> <ul>
<a name="1-6-7"></a> <a name="1-6-7"></a>
<li> <li>