码迷,mamicode.com
首页 > 其他好文 > 详细

获取当前元素的属性值

时间:2019-07-13 13:19:52      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:click   logs   获取   http   state   lan   www   使用   item   

1. 简单示例

...
deleteIP(e) {
    // 使用 e.target.getAttribute 来取值
    this.state.whitelist.splice(e.target.getAttribute("data"), 1);
    this.setState({‘whitelist‘: this.state.whitelist});
},
...
// 使用data来传值
<Button data={item} onClick={this.deleteIP}>删 除</Button>
...

2. 参考 todolist

 

获取当前元素的属性值

标签:click   logs   获取   http   state   lan   www   使用   item   

原文地址:https://www.cnblogs.com/stellar/p/11180061.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!