Answers for "how to call function from parent component in child component vue"

0

how to call function from parent component in child component vue

this.$parent.someMethod();
Posted by: Guest on August-17-2021
0

trigger a function inside child from parent vue

import ChildForm from './components/ChildForm'

new Vue({
  el: '#app',
  data: {
    item: {}
  },
  template: `
  <div>
     <ChildForm :item="item" ref="form" />
     <button type="submit" @click.prevent="submit">Post</button>
  </div>
  `,
  methods: {
    submit() {
      this.$refs.form.submit()
    }
  },
  components: { ChildForm },
})
Posted by: Guest on December-05-2020

Code answers related to "how to call function from parent component in child component vue"

Code answers related to "Javascript"

Browse Popular Code Answers by Language