Using Vform with Nuxt JS
See original GitHub issueIs there any way I can use Vform with Nuxt JS as a plugin? https://nuxtjs.org/guide/plugins/
So that I don’t have to add below code on all the pages?
import { Form, HasError, AlertError } from 'vform'
Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)
I tried to create plugin by adding a vform.js file inside nuxt plugins folder
import Vue from 'vue'
import { Form, HasError, AlertError } from 'vform'
Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)
But when on any nuxt page if I do new Form()
, it says “Form” is not defined.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Intro to Nuxt 3 VeeValidate Form Validation to Your ... - YouTube
... will show you how to quickly add Nuxt 3 VeeValidate Form Validation for Vue. js to Your Nuxt 3 / Vue. js...
Read more >vform - npm
Start using vform in your project by running `npm i vform`. There are 3 other projects in the npm registry using vform.
Read more >Easily Handle Laravel-Vue Forms and Validation with Vform
vue-js. vform is a tiny library for Vue 2 & Vue 3 to assist with forms and validation when utilizing Laravel as a...
Read more >Validating using vform in Vue Js - laravel - Stack Overflow
am using Vue Js and Laravel in my application. My code has products and images. I am able to upload images using axios...
Read more >Form component — Vuetify
Vuetify is a Material Design component framework for Vue.js. ... The internal v-form component makes it easy to add validation to form ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try this: https://github.com/cretueusebiu/vform/issues/30#issuecomment-412006708
import Vue from ‘vue’; import { Form, HasError, AlertError, AlertSuccess } from ‘vform’; Vue.component(HasError.name, HasError); Vue.component(AlertSuccess.name, AlertSuccess); Vue.component(AlertError.name, AlertError);
export default ({ app }, inject) => { Form.prototype.submit = function submit(method, url, config = {}) { this.startProcessing();
};
app.$vform = (…params) => new Form(…params); inject(‘vform’, (…params) => new Form(…params)); };