amsik / liquor-tree

Tree component based on Vue.js
MIT License
398 stars 95 forks source link

Selected notes on mount returns 0 nodes #243

Open buzzclue opened 2 years ago

buzzclue commented 2 years ago
mounted() {
      console.log(this.$refs.vaults.selected())
      this.$nextTick(() => {
          console.log(this.$refs.vaults.selected())
      });
},

How to get the selected notes on mounted hook? Even the $nextTick returns 0 when there are selected item in tree data?

buzzclue commented 2 years ago

I found a workaround, in the mounted event of component I got the selected nodes.

this.$refs.vaults.$on("tree:mounted", (tree) => {
    console.log(this.$refs.vaults.selected())
});