Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为什么nav的事件会触发多次 #22

Closed
witwave opened this issue Jun 27, 2018 · 3 comments
Closed

为什么nav的事件会触发多次 #22

witwave opened this issue Jun 27, 2018 · 3 comments

Comments

@witwave
Copy link

witwave commented Jun 27, 2018

<nav class="nav" @click="click"  >
<button type="button" class="nav__button nav__button--success" data-action="" title="测试" ><span class="fa fa-check"></span></button>
</nav
   click({ target }) {
      const action = target.getAttribute("data-action") || target.parentElement.getAttribute("data-action");
      console.log('traget',action);
      if (action) {
        this.$emit("change", action);
      }
    }

点击一下,会触发多次,有时一次,有时二次...

@fengyuanchen
Copy link
Owner

点击 <label> 元素会多触发一次 click 事件。

@witwave
Copy link
Author

witwave commented Jun 28, 2018

但这样会有问题,我点了crop,然后再取消,然后再点crop,再点取消,同时会直接调了remove。请问下,怎么只触发一次事件?
@fengyuanchen

@witwave
Copy link
Author

witwave commented Jun 28, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants