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

    Object in v-model

    Help
    2
    3
    289
    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.
    • D
      deer last edited by

      I tried to define an object in v-model in a parent component & then use it in child component(CarSearch.vue) but whenever I made changes & press the button , I get null for the changed object in the console .

      Screenshot 2021-02-14 at 22.09.36.png

      I would like to know how I should modify my code to see the changed value in the console.
      Here is my code in codesandbox .

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @deer last edited by

        @deer

        That’s because in Vue changes in props made by the child component don’t go down to the parent where they came from. You’ll have to use events to send changes from the child to the parent to update.

        See:
        https://medium.com/quick-code/vue-communication-patterns-an-intro-to-props-down-and-events-up-pattern-d53340d2c94

        D 1 Reply Last reply Reply Quote 0
        • D
          deer @dobbel last edited by

          @dobbel actually it’s possible to use change, I solved it you can check it out:
          https://codesandbox.io/s/awesome-hooks-my4fk?file=/src/components/CarSearch.vue

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