We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
认为缺少一个这样点API: 当选择一个子节点,应该返回该子节点选择路径数组,也就是所有父节点。 举例: 当树结构是 省市区,那么直接选择某个区,应该有一个获取包括当前区及所在省市的信息API。 目前的实现方法:
<template> <v-tree ref="tree" :data="treeData" :tpl="tpl" :draggable="false" :radio="true" :maxLevel="4" :allowGetParentNode="true" @node-select="nodeSelect" /> </template> <script> import 'vue-tree-halower/dist/halower-tree.min.css' import { VTree } from 'vue-tree-halower' export default { components: { VTree }, data() { return { treeData: [ { title: '南山区', children: [ { title: '粤海街道', children: [ { title: '科苑北路1' }, { title: '科苑北路2' }, { title: '科苑北路3' } ] } ] } ] } }, methods: { tpl(node, ctx, parent, index, props) { let titleClass = node.selected ? 'node-title node-selected' : 'node-title' if (node.searched) titleClass += ' node-searched' node.parent = () => parent //节点标题 const titleNode = ( <span class={titleClass} domPropsInnerHTML={node.title} onClick={() => this.$refs.tree.nodeSelected(node, props)} /> ) return <span>{titleNode}</span> }, nodeSelect(node) { const list = [node] while (node.parent() !== null) { list.push(node.parent()) node = node.parent() } console.log(list.map(item => item.title)) } } } </script>
The text was updated successfully, but these errors were encountered:
你不是实现了嘛
Sorry, something went wrong.
No branches or pull requests
认为缺少一个这样点API:
当选择一个子节点,应该返回该子节点选择路径数组,也就是所有父节点。
举例:
当树结构是 省市区,那么直接选择某个区,应该有一个获取包括当前区及所在省市的信息API。
目前的实现方法:
The text was updated successfully, but these errors were encountered: