Friday, 8 November 2019

Vue-Laravel form Submission

I have a form created in vue and added to a blade page.

app.js

new Vue({
    router,
    components: {
        'advice-form': AdviceForm,
    }
}).$mount('#app');

blade.php

<div class="my-6">
    <advice-form></advice-form>
</div>

AdviceForm Component

<input
  class="md:w-auto w-full"
  type="text"
  name="name"
  id="name"
  placeholder="Full name"
  v-model="name"
/>

When I try to add v-model for inputs I get an error saying Property or method "name" is not defined on the instance but referenced during render. I am sure the name is defined in the data property. Also, the <advice-form></advice-form> is placed within the #app div in blade page.

Can anyone help me figure out what is the problem?



from Vue-Laravel form Submission

No comments:

Post a Comment