Vuetify v-treeview,如何显示没有子节点的内容?
Vuetify 网站有一个很好的动态加载树示例。如果单击叶节点(没有子节点的节点),它将显示其内容。使用v-on:update:active
事件,可以很容易地知道这些节点何时被选择。我还想显示有子节点的内容。但是,单击这些节点会打开或关闭它们。我想在单击其文本时显示其内容,并在单击其打开/关闭图标时打开/关闭它们。我该怎么做呢?
请记住,我需要节点的 id
才能访问其内容。我正在使用Vue2。
The Vuetify site has this nice example of a dynamic load tree. If you click in a leaf node (a node without children) it shows its content. Using the v-on:update:active
event, it is easy to know when these nodes are selected. I would like to also show the content of nodes that have children. However, clicking on these nodes opens or closes them. I would like to show their content when I click on their text, and open/close them when I click on their open/close icons. How can I do it?
Remember that I need the id
of a node to access its contents. I am using Vue2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只需要删除属性
open-on-click
。在文档中,它指出:当将此道具与可激活的一起使用时,您将无法将具有子节点的节点标记为活动。
但使用
:active.sync=" 时没有任何问题active”
(this.active
是一个组件字段)来获取活动节点。I just needed to delete the attribute
open-on-click
.In the documentation, it states that: When using this prop with activatable you will be unable to mark nodes with children as active.
But I did not have any problem using
:active.sync="active"
(this.active
is a component field) to get the active nodes.