Vue.js 删除带有vue标记的方法输入vue Js
我尝试在VUEJS中输入的vue标记中创建一个delete方法。我不知道如何获得索引。从这个标签。通常在我的delete方法中,我使用索引Vue.js 删除带有vue标记的方法输入vue Js,vue.js,vuejs2,Vue.js,Vuejs2,我尝试在VUEJS中输入的vue标记中创建一个delete方法。我不知道如何获得索引。从这个标签。通常在我的delete方法中,我使用索引 <vue-tags-input v-model="tagName" class="tags-input w-100 mt-0" @before-deleting-tag="deleteCustomerName" /> deleteCustomerName: function () { const id =
<vue-tags-input
v-model="tagName"
class="tags-input w-100 mt-0"
@before-deleting-tag="deleteCustomerName"
/>
deleteCustomerName: function () {
const id = this.editedItemId;
const id_c = 33; //right now I am not sure how to get id_c
// const deleted_user_name = this.customer_names[index].name;
this.boxOne = "";
this.$bvModal
.msgBoxConfirm("Are you sure that you want to delete this ?", {
okVariant: "danger",
okTitle: "Delete",
cancelTitle: "Cancel",
centered: true
})
.then(confirm => {
if (confirm) {
deleteApi("/customers/" + id + "/" + id_c).then(() => {
this.$nextTick(() => {
// this.$emit('deleted',deleted_user_name)
// this.customer_names.splice(index, 1); //usualy I do this, but now it doesn't now how index is
console.log('User deleted!');
});
});
}
})
.catch(error => {
console.log(error);
});
},
deleteCustomerName:函数(){
const id=this.editemid;
const id_c=33;//现在我不知道如何获得id_c
//const deleted\u user\u name=this.customer\u names[index].name;
此项。boxOne=“”;
这个.$BV
.msgBoxConfirm(“是否确实要删除此?”{
“危险”,
okTitle:“删除”,
取消标题:“取消”,
对
})
。然后(确认=>{
如果(确认){
deleteApi(“/customers/”+id+“/”+id_c)。然后(()=>{
这个.$nextTick(()=>{
//此.$emit('deleted',deleted_user_name)
//this.customer_names.splice(index,1);//通常我会这样做,但现在不知道索引是什么
console.log('User deleted!');
});
});
}
})
.catch(错误=>{
console.log(错误);
});
},
以下是描述。在删除标记之前,返回索引、标记、删除标记[func]
,因此需要在删除客户名称
参数范围内设置参数
deleteCustomerName: function (params) {
console.log(params.index)
....
}