惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
B
Blog
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
N
Netflix TechBlog - Medium
P
Privacy International News Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
G
Google Developers Blog
Recorded Future
Recorded Future
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
G
GRAHAM CLULEY
A
Arctic Wolf
N
News | PayPal Newsroom
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Visual Studio Blog
Webroot Blog
Webroot Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
H
Heimdal Security Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
M
MIT News - Artificial intelligence
V2EX - 技术
V2EX - 技术
Jina AI
Jina AI
TaoSecurity Blog
TaoSecurity Blog
NISL@THU
NISL@THU
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
WordPress大学
WordPress大学
V
V2EX
Cyberwarzone
Cyberwarzone
Stack Overflow Blog
Stack Overflow Blog
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More

博客园 - 幸福的菜菜

windows下使用ACME申请SSL证书的办法 Windows10 LTSC版本 无法访问网络中部分的共享文件夹 SqlSugar : date绑定到XX失败,可以试着换一个类型,或者使用ORM自定义类型实现 VisualStudio Debug模式突然变慢 Visual Stadio 编译提示 The BaseOutputPath/OutputPath property is not set for project ... winform绘图与前端canvas绘图效率对比 node-sass编译不通过, 提示 “checking for Python executable "python2" in the PATH” c# async await的使用方式及为啥要用它 winform 实现对usb热拔插的监听 Laravel The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths Wampserver 配置端口可访问服务 git credential for windows 总是弹出的问题 如何用B表的数据,更新A表的值 WampServer部署https 服务的过程 PHP 命名空间冲突解决方式 Windows下 Docker 简单部署 Django应用 C#实现后台格式化U盘的功能 Winform 实现断点续传的思路及代码 WAMPServer ServerName has syntax error 的问题(阿里云服务器上)
ElementPlus Radio 实现双击取消选择的效果
幸福的菜菜 · 2025-08-13 · via 博客园 - 幸福的菜菜

效果如下所示,在element plus中是没有直接双击取消选择的。但是我可以通过代码去实现

动画

基本思路是:点击事件 和 变更事件会依次触发。如果只有单击事件没有变更事件触发,则说明点击到的是同一位置。
将监听值还原即可

<script>

const showMode = ref('0');

//通过时间 和 缓存值,来判断是否是点击事件。实现取消选择模式
let showModeChangeTime:Date = new Date();
const showModeChanged = (value: string) => {
  showModeChangeTime = new Date();
}

const showModeClick = () => {
  setTimeout(() => {
    //延迟触发,判断是否是点击事件。 如果没有触发  showModeChanged 说明是点击当前元素,则取消选择。 
    let now = new Date();
    console.log('showModeClick',now.getTime() - showModeChangeTime.getTime())
    if(now.getTime() - showModeChangeTime.getTime() > 50){
      showMode.value = '0';
    }
  }, 0);
}

</script>




<template>

  <el-radio-group v-model="showMode" size="small" fill="#6cf" @change="showModeChanged" @click="showModeClick" style="margin-left: 20px;">
      <!-- <el-radio-button label="无" value="0" /> -->
      <el-radio-button label="Die数量" value="1" />
      <el-radio-button label="Die良率" value="2" />
      <el-radio-button label="Die占比" value="3" />
    </el-radio-group>
</template>