Answers for "vue watch props"

1

vue watch props

new Vue({
  el: '#app',
  data: {
    text: 'Hello'
  },
  components: {
    'child' : {
      template: `<p>{{ myprop }}</p>`,
      props: ['myprop'],
      watch: { 
      	myprop: function(newVal, oldVal) { // watch it
          console.log('Prop changed: ', newVal, ' | was: ', oldVal)
        }
      }
    }
  }
});
Posted by: Guest on May-18-2020
0

how to watch for changes within a prop in vue

watch: {
    $props: {
      handler() {
        this.parseData();
      },
      deep: true,
      immediate: true,
    },
Posted by: Guest on September-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language