解决vue 多级下拉框有空白页问题
作者:互联网
getSelectionList () { // 获取下拉框内容 var vm = this var url = 'localhost:8080/demo' + '/demo/selectList' var data = {} 请求.postJson(vm, url, data, function (res) { vm.selectionList=vm.getTreeData(res.data) }) },
getTreeData(data) { // 递归判断列表,把最后的children设为undefined for (var i = 0; i < data.length; i++) { if (data[i].children.length < 1) { // children若为空数组,则将children设为undefined data[i].children = undefined; } else { // children若不为空数组,则继续 递归调用 本方法 this.getTreeData(data[i].children); } } return data; },
标签:vue,undefined,vm,下拉框,getTreeData,var,空白页,data,children 来源: https://www.cnblogs.com/idreamer/p/14660931.html