我有这个
<span @click="remove(product)" class="btn btn-sm btn-danger"><i class="fa fa-times"></i></span> element, It triggers this function:<br/>
remove(product) {
this.form.products.$remove(product);
} <br/>
但是它输出以下错误:TypeError: this.form.products.$remove is not a function
我不知道出了什么问题。
答案 0 :(得分:1)
使用view_namespace '=>' vendor.template.admin ',
\ Resources \ views \ vendor \ template \ admin \
方法从数组中删除项目
首先获取商品的索引
splice
然后使用let index = this.form.products.indexOf(product);
splice