当前位置:网站首页>Listen for click events other than an element
Listen for click events other than an element
2022-04-23 17:43:00 【Front Thoughts】
demand : Sometimes if we need to listen to the click event of touching an element position , for example input Box get focus floppy disk pop up , Hold up position: absolute; bottom: 0; At the bottom dmoe Elements , Now I click the floppy disk pop-up status and click this dmoe The floppy disk will not lose focus !
npm:
npm i @vueuse/core
From v6.0, VueUse requires vue >= v3.2 or @vue/composition-api >= v1.1
CDN
<script src="https://unpkg.com/@vueuse/shared"></script>
<script src="https://unpkg.com/@vueuse/core"></script>
import {
onClickOutside } from '@vueuse/core'
hold target Load on the outer container
<div class="content" ref="target">
setup() {
// Click the mouse outside the target , The callback is executed
onClickOutside( Target of monitoring , (e) => {
// Click the mouse outside the target , What to do ?
})
}
setup () {
// ...
// Click another location to hide
const target = ref(null)
onClickOutside(target, () => {
closeDialog()
})
return {
visible, toggleDialog, target }
}
版权声明
本文为[Front Thoughts]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230551157033.html
边栏推荐
- Router object, route object, declarative navigation, programmed navigation
- 122. 买卖股票的最佳时机 II-一次遍历
- flink 学习(十二)Allowed Lateness和 Side Output
- This point in JS
- Change Oracle to MySQL
- 41. The first missing positive number
- 239. 滑动窗口最大值(困难)-单向队列、大顶堆-字节跳动高频题
- 土地覆盖/利用数据产品下载
- If you start from zero according to the frame
- JVM类加载机制
猜你喜欢
01-初识sketch-sketch优势
Matlab / Simulink simulation of double closed loop DC speed regulation system
编译原理 求first集 follow集 select集预测分析表 判断符号串是否符合文法定义(有源码!!!)
958. 二叉树的完全性检验
92. Reverse linked list II byte skipping high frequency question
嵌入式系统中,FLASH中的程序代码必须搬到RAM中运行吗?
MySQL进阶之索引【分类,性能分析,使用,设计原则】
SystemVerilog(六)-变量
[difference between Oracle and MySQL]
Learning record of uni app dark horse yougou project (Part 2)
随机推荐
Use of five routing guards
[binary number] maximum depth of binary tree + maximum depth of n-ary tree
Manually implement simple promise and its basic functions
JS interview question: FN call. call. call. Call (FN2) parsing
Qt error: /usr/bin/ld: cannot find -lGL: No such file or directory
958. Complete binary tree test
Commonly used functions -- spineros:: and spineros::)
古代埃及希腊,数学用的什么进制
440. 字典序的第K小数字(困难)-字典树-数节点-字节跳动高频题
SystemVerilog(六)-变量
给 el-dialog 增加拖拽功能
JS parsing and execution process
JVM class loading mechanism
Header built-in object
Router object, route object, declarative navigation, programmed navigation
Write a regular
C语言程序设计之函数的构造
Leak detection and vacancy filling (VIII)
Matlab / Simulink simulation of double closed loop DC speed regulation system
31. 下一个排列