element
element copied to clipboard
[Bug Report] click the el-switch component to trigger two click events at the same time
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事件
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
你使用@click.native事件,状态改变自动触发了它组件自身的change事件,然后你增加点击事件再次触发,所以触发了两次。 你应该使用官网提供的@change事件,就是当你开关状态改变的时候就会运行,跟你click效果是一样的