页面如图所示:点击删除时现在的问题是:我点击删除后,我怎么判断我删除的这个id为多少?HTML代码:<div id="app" class="container"> <table class="table table-hover"> <tbody> <tr> <th>id</th> <th>名称</th> <th>操作</th> </tr> <tr v-for="item in formData"> <th>{{item.id}}</th> <th>{{item.name}}</th> <th><button data-toggle="modal" data-target="#myModal">删除</button></th> </tr> </tbody> </table> <!-- 弹出框 --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">提示</h4> </div> <div class="modal-body"> 你确定要删除吗? </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> <button type="button" class="btn btn-primary" @click="clickMe">确定</button> </div> </div> </div> </div></div>js代码:new Vue({ el:"#app", data:{ formData:[ { id:1, name:"苹果" }, { id:2, name:"西瓜" }, { id:3, name:"葡萄" }, ] }, methods:{ clickMe:function(){ alert("你删除的id为:" + 1); //这里要弹出我点删除的id为多少 } }})
添加回答
举报
0/150
提交
取消