Element: el-button怎么点击触发事件

Created on 12 Sep 2016  ·  6Comments  ·  Source: ElemeFE/element

<el-button type="text" icon="edit" @click="edit(1)"></el-button>

edit(index) {
    console.log(index);
}

点击按钮无法触发edit事件

Most helpful comment

<el-button @click.native="edit">默认按钮</el-button>

@TDiDa 看到你的代码了,补充一下,Vue2中自定义组件都需要.native才能使用原生事件。

All 6 comments

<el-button @click.native="edit">默认按钮</el-button>

@TDiDa 看到你的代码了,补充一下,Vue2中自定义组件都需要.native才能使用原生事件。

@csvwolf 可以了,多谢

jsx 的这个语法是什么?

nativeOn

@csvwolf 你好,你说VUE2,要加.native才能监听原生事件,这是什么意思啊,难道还有自定义的onclick事件吗?

@DanielWLam
https://github.com/ElemeFE/element/blob/master/FAQ.md

建议看一下Vue2的文档

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akaylh picture akaylh  ·  3Comments

chenzhe-pro picture chenzhe-pro  ·  3Comments

yuchonghua picture yuchonghua  ·  3Comments

chao-hua picture chao-hua  ·  3Comments

EdenSpark picture EdenSpark  ·  3Comments