0

I'm working on a small project, and I would like to know how can i watch my search key

this is my code :

data:() => ({
     form: {
        search: '',
     }
}),
watch: {
    // how can i watch search
}
Alice Munin
  • 511
  • 2
  • 13
  • 1
    Hi, This might help you, https://stackoverflow.com/questions/42133894/vue-js-how-to-properly-watch-for-nested-data#:~:text=var%20vm%20%3D%20new%20Vue(%7B%20data%3A%20%7B%20list%3A%20%5B,console. – Yash Maheshwari Apr 27 '21 at 03:09

1 Answers1

1
data: () => ({
    form: {
        search: '',
    }
}),
watch: {
    'form.search': (new, old) => {
        // do something
    }
}

full example on vue doc

Zaya
  • 104
  • 5