Calling <q-tree> component methods

  • Let’s say I have a tree component:


    How can I call a method from the tree component (let’s say the getNodeByKey(key) method) from inside an arbitrary method that is in <script> methods: {…} </script> ? In other words, how can I reference the q-tree element from outside it?


  • Give the tree component a ref
    :nodes = “companySetup”

    Then use it like this:
    methods: {

    nodeExists(key) {
        return this.$refs.tree.getNodeByKey(key)
    getSelectedNode() {
        return this.$refs.tree.getNodeByKey(this.selected)

Log in to reply