【发布时间】:2019-12-19 07:35:06
【问题描述】:
我有一个网站,当我尝试创建新内容并选择一个类别时出现错误。之前有没有遇到过这个问题?
我不知道如何解决这个问题。
setHierarchyPaths: function (categories, path) {
for (var i = 0; i < categories.length; i++) {
if (typeof path !== 'undefined') {
categories[i].path = path + '.' + categories[i].id;
} else {
categories[i].path = categories[i].id;
}
if (categories[i].childrens.length > 0) {
this.setHierarchyPaths(categories[i].childrens,
categories[i].path);
}
// We need a flat tree!
this.flatTree.push(categories[i]);
}
},
我已经上传了这 2 张图片的错误。希望你能帮我解决这个问题。 https://www.screencast.com/t/PWjbxIgJe
https://www.screencast.com/t/Jt2RN08G
非常感谢
【问题讨论】:
-
categories或categories[i].childrens是undefined。请给minimal reproducible example。 -
你怎么称呼
setHierarchyPaths?
标签: javascript php vue.js