标签:token ati attribute script get tps keyword ons 定义
HTML
<div id="app"> <button @click="getData($event,‘100‘)">点我</button> </div>
JS
methods : { getData(e,num) { console.log(num); // 输出 100 } }
HTML
<div id="app"> <button data-num="100" ref="dataNum" @click="getData($event)">点我</button> </div>
JS
methods : { getData (e) { console.log(this.$refs.dataNum.dataset.num); // 输出 100 } }
HTML
<div id="app"> <button data-num="100" @click="getData($event)">点我</button> </div>
JS
methods : { getData (e) { console.log(e.target.getAttribute(‘data-num‘)); // 输出 100 } }
标签:token ati attribute script get tps keyword ons 定义
原文地址:https://www.cnblogs.com/ygyy/p/12801267.html