<div id="app">
<button drug_code="100" @click="getData($event)">点</button>
</div>
methods : {
getData (e) {
console.log(e.target.getAttribute(‘drug_code‘)); // 输出 100
}
}
11-02
4679
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
<div id="app">
<button drug_code="100" @click="getData($event)">点</button>
</div>
methods : {
getData (e) {
console.log(e.target.getAttribute(‘drug_code‘)); // 输出 100
}
}