this.$nextTick(() => {
var levelName = document.getElementsByClassName('is-leaf');
for (var i = 0; i < levelName.length; i++) {
// 找到可以加class的div,再判断这个div的div[role='group']有没有项
const greatGranNode = levelName[i].parentNode.parentNode.parentNode,
hasChildren = Array.from(greatGranNode.querySelectorAll("div[role='group']")).findIndex(item => item.childNodes.length > 0) > -1;
if (Array.from(greatGranNode.classList).indexOf('el-tree-node__children') > -1 && !hasChildren) {
greatGranNode.classList.add('is-flex')
}
}
});