当前位置:网站首页>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
边栏推荐
- Metaprogramming, proxy and reflection
- Using quartz under. Net core - [1] quick start
- 常用SQL语句总结
- .Net Core3. 1 use razorengine NETCORE production entity generator (MVC web version)
- ECMAScript history
- 209. 长度最小的子数组-滑动窗口
- 470. 用 Rand7() 实现 Rand10()
- Using quartz under. Net core -- preliminary understanding of [2] operations and triggers
- 索引:手把手教你索引从零基础到精通使用
- 油猴网站地址
猜你喜欢

flink 学习(十二)Allowed Lateness和 Side Output

Halo open source project learning (II): entity classes and data tables

Use of five routing guards
![Using quartz under. Net core -- operation transfer parameters of [3] operation and trigger](/img/4e/2161fc448f4af71d9b73b7de64a17f.png)
Using quartz under. Net core -- operation transfer parameters of [3] operation and trigger

SystemVerilog(六)-变量

102. 二叉树的层序遍历

干货 | 快速抽取缩略图是怎么练成的?

Allowed latency and side output

Advantages and disadvantages of several note taking software
![Using quartz under. Net core - [1] quick start](/img/80/b99417e88d544ca6e3da4c0c1625ce.png)
Using quartz under. Net core - [1] quick start
随机推荐
Compilation principle first set follow set select set prediction analysis table to judge whether the symbol string conforms to the grammar definition (with source code!!!)
Where is the configuration file of tidb server?
Solution of Navicat connecting Oracle library is not loaded
2022年茶艺师(初级)考试模拟100题及模拟考试
Arithmetic expression
Header built-in object
239. 滑动窗口最大值(困难)-单向队列、大顶堆-字节跳动高频题
1217_ Generating target files using scons
Type judgment in [untitled] JS
Qt 修改UI没有生效
QT modification UI does not take effect
2022年上海市安全员C证操作证考试题库及模拟考试
92. Reverse linked list II byte skipping high frequency question
Using quartz under. Net core -- preliminary understanding of [2] operations and triggers
Client example analysis of easymodbustcp
Advantages and disadvantages of several note taking software
92. 反转链表 II-字节跳动高频题
MySQL advanced index [classification, performance analysis, use, design principles]
Chrome浏览器的跨域设置----包含新老版本两种设置
2022年流动式起重机司机国家题库模拟考试平台操作