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

    Side Drawers not working in small screens using v-model

    Framework
    3
    4
    1468
    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.
    • S
      supercat last edited by supercat

      I am using v-model powered by a vuex variable to control the right and left drawers. They trigger fine on desktop view but once the breakpoint is reached they may no longer be triggered by v-model changes, you must use this$refs.layout method. Has anyone experienced this or do I have something wrong here?

      1 Reply Last reply Reply Quote 1
      • benoitranque
        benoitranque last edited by benoitranque

        I’m pretty sure you are supposed to use the model only for watching layout state. Use the methods when possible.

        Tip: the layout component provides itself as ‘layout’ to any of it’s descendants. So in any component that is a descendant of the layout, including views, you can do this:

        export default {
          ...
          inject: [ 'layout' ],
          methods: {
            toggle () {
              this.layout.toggleLeft()
            }
          }
        }
        

        The vue feature by the way is provide/inject. Read and article about it here and it’s docs here

        1 Reply Last reply Reply Quote 0
        • D
          dsahoo last edited by dsahoo

          I am too having the exact same problem. V-model works only for desktop view as soon as I reduce the browser size to mobile view its stops working. I have also tried watching the model of the layout but that too doesn’t work until I increase the size of the browser to full desktop size, basically v-model has no effect when the browser is resized to mobile size. It seems like a bug to me. Please let me know if I am missing something.
          As per the example provided in the documentation, the v-model is used to toggle the drawer state on click of a button but it just works only on desktop view.

          1 Reply Last reply Reply Quote 0
          • S
            supercat last edited by

            @benoitranque for me this solution would lead to bad practice as I have all kinds of logic to determine whether the the left and right drawers should be opened or closed in a Vuex mutation. This way i would be forced to put that logic in every deep component that can change the sidebars rather than one succinct commit call. The documentation gives an example of using v-model to handle the sidebars and it works perfectly in desktop mode. So I am seconding @dsahoo that I also think this is a bug.

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