Subscribe on changes!

Is there any way to watch a Map in addition to using entries()?

avatar
Feb 27th 2021

Version

3.0.6

Reproduction link

https://codesandbox.io/s/serene-lewin-11xuh?file=/src/App.vue

Steps to reproduce

  1. click button

What is expected?

11 be priented in console.

What is actually happening?

Nothing happended.

avatar
Feb 27th 2021

I just now change the demo to watch the test.test.entries(), it works.

But is there any other way?

avatar
Feb 27th 2021

looks like a solid way. Please use chat.vuejs.org for further usage questions.

avatar
Feb 27th 2021

looks like a solid way. Please use chat.vuejs.org for further usage questions.

Thank you, but when watch the Map directly, cb will not be called, is it a right behavior?

@LinusBorg

avatar
Feb 27th 2021

works fine use deep

watch(() => test.test, () => {
    console.log(111)
},{deep:true})

or

watch(test.test, () => {
  console.log(111)
})
avatar
Feb 28th 2021

works fine use deep

watch(() => test.test, () => {
    console.log(111)
},{deep:true})

or

watch(test.test, () => {
  console.log(111)
})

Thank you. 👍