When vue clicks delete, how can I be sure which one I clicked?

The

page is shown in the figure

clipboard.png

clipboard.png

the question now is: after I click Delete, how can I tell how much id I deleted?

HTML Code:

<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="-sharpmyModal"></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 Code:

new Vue({
    el:"-sharpapp",
    data:{
        formData:[
            {
                id:1,
                name:""
            },
            {
                id:2,
                name:""
            },
            {
                id:3,
                name:""
            },
        ]
    },
    methods:{
        clickMe:function(){
            alert("id:" + 1); //id
        }
    }
})

my opinion:
can bind the click event to the button where deletes , and then sets selectedRow as the idx, of the currently selected row so that it can be obtained through this.selectedRow .

  https://github.com/kangbb/tree

Menu