vue数据循环下的input和button,点击button获取对应input的数据
<li v-for="(kxz, index) in kxz " id="wz1"><div class="grid-content bg-purple input"><input class="text_fz":id="'text'+index"type="text" :value=kxz.wz>&l...
·
<li v-for="(kxz, index) in kxz " id="wz1">
<div class="grid-content bg-purple input">
<input class="text_fz" :id="'text'+index" type="text" :value=kxz.wz>
<el-button @click="myCopy(index)" :data-id="index" type="primary" plain>复制地址</el-button>
</div>
</el-row>
</li>
myCopy: function(index) {
// console.log(index)
let ele = document.getElementById("text"+index);
ele.select();
document.execCommand("Copy");
// alert("复制成功");
}
更多推荐
已为社区贡献5条内容
所有评论(0)