vue 父循环怎么拿子循环中的值_VUE v-for多层嵌套循环怎么取父级的值啊

VUE

我想点击删除可以删除当前值,怎么实现啊?谢谢大家。

template代码

删除

{{list.title}}

删除1

{{list1.title}}
{{list2.title}}

删除2

JS代码

export default {

data () {

return {

dylist: [{

id: '1',

title: "标题一",

commentlist: [{

cid: "1",

title: "评论一",

answerlist: [{

aid: "1",

title: "回复一"

},

{

aid: "2",

title: "回复一"

}]

}]

},{

id: '2',

title: "标题二",

commentlist: [{

cid: "2",

title: "评论啊啊啊啊啊",

answerlist: []

}]

}]

}

},

methods: {

DEL: function (index) {

var v = this

$.ajax({

async: true,

type: "POST",

url: "del.do",

data: {

"id": v.dylist[index].id /*这样可以拿到最外层的id*/

},

dataType: "json",

success: function(result){

v.dylist.splice(index, 1) ;

}

});

},

DELlist1: function (index) {

var v = this

$.ajax({

async: true,

type: "POST",

url: "DELlist1.do",

data: {

"cid": v.dylist[index].commentlist.cid /*当我需要cid的时候怎么拿呀?*/

},

dataType: "json",

success: function(result){

}

});

},

DELlist2: function (index) {

var v = this

$.ajax({

async: true,

type: "POST",

url: "DELlist1.do",

data: {

"aid": v.dylist[index].commentlist.answerlist.aid /*当我需要aid的时候怎么拿呀?*/

},

dataType: "json",

success: function(result){

}

});

},

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值