【发布时间】:2018-11-16 00:12:47
【问题描述】:
如果状态为真,我需要从 html vue js 中的字段拼接该数组
我需要将索引值传递给函数。 怎么可能。
我的错误是
Uncaught ReferenceError: index is not defined
at Object.success (80155f2d-c534-4b8f-ba5f-20edef1496ab:1032)
at i (jquery-3.2.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.2.1.min.js:2)
at A (jquery-3.2.1.min.js:4)
at XMLHttpRequest.<anonymous> (jquery-3.2.1.min.js:4)
我的html代码是
<div class="card-content" v-for="(arrest, index) in arestee" :key="index">
--my data--
<a @click="deleteSubmit(arrest)" target="_blank">Delete Arestee</a></button>
</div>
单击删除提交逮捕后,我将数据传递给函数
我的vue js代码是
deleteSubmit: function(arrest) {
var vm = this;
data = {};
data['docId'] = this.id;
$.ajax({
url: 'http://localhost:4000/doc/remove/',
data: data,
type: "POST",
dataType: 'json',
success: function(arrest) {
if (arrest.status)
{
alert("Success")
arrest.splice(index, 1);
}
else {
alert("Failed")
}
}
});
return false;
},
arrest.splice(index, 1);
我需要将索引值传递给这个
【问题讨论】:
-
也只是通过了索引,就像你通过逮捕一样。像这样:
deleteSubmit(arrest, index) -
如果有,如何更新功能?
标签: javascript html vue.js vue-component