fix(fullscreen): 修复事件移除

This commit is contained in:
sight 2022-04-06 21:11:59 +08:00
parent 303256afa1
commit e331cb2e68
2 changed files with 12 additions and 8 deletions

View File

@ -205,8 +205,8 @@ onMounted(() => {
onBeforeUnmount(() => { onBeforeUnmount(() => {
//@ts-ignore //@ts-ignore
document.addEventListener(fullscreenAPI.fullscreenchange, onFullscreenchange); document.removeEventListener(fullscreenAPI.fullscreenchange, onFullscreenchange);
document.addEventListener("keydown", onFullscreenchange); document.removeEventListener("keydown", onFullscreenchange);
}); });
</script> </script>

View File

@ -52,7 +52,7 @@
<div class="code">layui-anim-fadein</div> <div class="code">layui-anim-fadein</div>
</li> </li>
<li style="height:auto"> <li style="height:auto">
<div class="layui-anim layui-anim-fadeout" @click="replay">渐隐</div> <div class="layui-anim" @click="replay($event,'layui-anim-fadeout')">渐隐</div>
<div class="code">layui-anim-fadeout</div> <div class="code">layui-anim-fadeout</div>
</li> </li>
<li style="height:auto"> <li style="height:auto">
@ -72,14 +72,18 @@ import { ref } from 'vue'
export default { export default {
setup() { setup() {
const replay = (e) => { const replay = (e, aninClass) => {
const el = e.currentTarget; const el = e.currentTarget;
const targetClass = el.classList[1]; const targetClass = el.classList[1];
if(!targetClass){
el.classList.add(aninClass);
}else{
el.classList.remove(targetClass); el.classList.remove(targetClass);
setTimeout(() => { setTimeout(() => {
el.classList.add(targetClass); el.classList.add(targetClass);
},100) },100)
} }
}
return { return {
replay replay
} }