cretueusebiu / vform

Handle Laravel-Vue forms and validation with ease.
https://vform.vercel.app
MIT License
607 stars 120 forks source link

[Vue warn]: Property or method "form" is not defined on the instance but referenced during render. #119

Closed usmanbasharmal123 closed 3 years ago

usmanbasharmal123 commented 3 years ago

app.js:43619 [Vue warn]: Property or method "form" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the

code in app.

require('./bootstrap');
import Vue from 'vue';
window.Vue = require('vue').default;
import VueRouter from 'vue-router';
import { Form, HasError, AlertError } from 'vform';
window.Form = Form;
Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)

cod in app.blade.php

  <div class="right_col" role="main">
                    {{-- @yield('content') --}}
                    <router-view></router-view>

                </div>
 <script src="{{ asset('js/jquery.min.js') }}"></script>
 <script src="{{ asset('js/app.js') }}"></script>

code in user.vue

<div class="modal-body">
              <div class="form-group">

      <input v-model="form.uname" type="text" name="name">
    </div>
<script>
    export default {
        data () {
    return {
      form: new Form({
        uname: '',
        email:'',
        password: ''
      })
    }},     
    }
cretueusebiu commented 3 years ago

Always import the form class where you use it.

import Form from 'vform'

new Form({ })
usmanbasharmal123 commented 3 years ago

Thanks for the prompt response I solved it that was my bad sorry for the inconvenience.