Methods of resetting forms in Vue

<form ref="Custom name". >// By calling this method
this.$refs. Custom name. ResetFields ()// Reset the form

Copy the code

Custom component global registration

// Register in min.js file
import Vue from 'vue'
//1. Reference component to min.js file
importComponent namefrom 'Component path'
/ / 2. The registration
Vue.component('Component name', component object)// The min.js file becomes difficult to maintain when there are too many components, so you need to create a js fileMultiple components are registered with vue.use ()// It is a static method that Vue provides to register plug-ins with Vue. Documents: https://cn.vuejs.org/v2/api/#Vue-use-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a way1.Create a JS file and import a Vue objectimport Vue from 'vue'
2.The introduction of the componentimportComponent namefrom 'Component path'
3.registeredconst xxx = {
    install(Vue){
        Vue.component('Component name', component object)}} vue.use (XXX)4.Import the created js file into min.jsimport 'Created file path'
5.Page with < component name / > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- way 21.Create a JS file and import a Vue objectimport Vue from 'vue'
2.The introduction of the componentimportComponent namefrom 'Component path'
3.registeredexport default {
    install(Vue){
        Vue.component('Component name', component object)}}4.Import the created js file into min.jsimportComponent namefrom 'Created file path'Vue.use(Component name)5.Use < component name /> in pagesCopy the code

Custom component local registration

// use in the page< component name ></ Component name >// Use it as a label
1.referenceimportComponent namefrom 'Component path'
2.registeredexport default {
    components:{component name}}Copy the code