Answers for "vue watch doesn't work on prop"

0

vue watch doesn't work on prop

// in case you want to watch a prop in component
// you can change props to refs and it will work.

// Example (composition api):

import { watch, toRefs } from '@vue/composition-api'

setup() {
  const propsRef = toRefs(props)
  watch(propsRef.automation, () => {
        console.log('watching automation prop')
        })
  }
Posted by: Guest on August-10-2021

Browse Popular Code Answers by Language