No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Communicating Between Two Components

    Help
    2
    2
    204
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      moshemo last edited by

      I have two .vue files: header.vue and drawer.vue.

      header.vue contains a button that is supposed to toggle open or shut the drawer (it does so by toggling a boolean value to true or false). drawer.vue has the data that needs to be toggled when the button is clicked (i.e., it contains the boolean value).

      How can I get the two files to communicate with one another without having to combine the contents of the two file into a single .vue. file?

      qyloxe 1 Reply Last reply Reply Quote 0
      • qyloxe
        qyloxe @moshemo last edited by qyloxe

        @moshemo put the variable drawerOpen in Vuex then in both components you can use vue computed getter and setter:

        https://vuejs.org/v2/guide/computed.html#Computed-Setter

        The code for those getters you can even put in the mixins and import it in both components:
        https://vuejs.org/v2/guide/mixins.html

        1 Reply Last reply Reply Quote 0
        • First post
          Last post