element icon indicating copy to clipboard operation
element copied to clipboard

[Bug Report] click the el-switch component to trigger two click events at the same time

Open levi1994 opened this issue 8 years ago • 2 comments

Element UI version

2.0.11

OS/Browsers version

macOS 10.12.6 / chrome 63.0.3239.132

Vue version

2.5.13

Reproduction Link

https://jsfiddle.net/1byqk4gn/2/

Steps to reproduce

引入el-switch组件

使用@click.native监听组件的click事件

What is Expected?

点击组件,只触发一次click事件

What is actually happening?

点击组件,触发了两次click事件

levi1994 avatar Feb 09 '18 06:02 levi1994

Translation of this issue:

Element UI version

2.0.11

OS/Browsers version

MacOS 10.12.6 / Chrome 63.0.3239.132

Vue version

2.5.13

Reproduction Link

https://jsfiddle.net/1byqk4gn/2/

Steps to reproduce

Introducing el-switch components

Using the @click.native to monitor the click event of the component

What is Expected?

Click on the component and trigger only one click event

What is actually happening?

Click the component to trigger two click events

element-bot avatar Feb 09 '18 06:02 element-bot

你使用@click.native事件,状态改变自动触发了它组件自身的change事件,然后你增加点击事件再次触发,所以触发了两次。 你应该使用官网提供的@change事件,就是当你开关状态改变的时候就会运行,跟你click效果是一样的

littlePig-zzf avatar Feb 09 '18 10:02 littlePig-zzf