Summary of Precautions for Vue Use (Continuous Update)

Vue is a front-end framework we often use. Although it is very simple to use and the official doc is relatively clear, there are still incomplete places that may lead us to step into a pit.

Form verification

We often use forms when using Vue + ElementUI, and we also use the validation function with forms, but we need to pay attention to one thing that is not mentioned in the official doc when using it, that is, if the prop attribute value of el-form-item is the same as the value bound by the v-model of the form item wrapped in el-form-item, otherwise the verifier in the verification rule bound by the rules attribute of el-form will not be able to obtain the data of the form item, which will cause the verification to always fail to pass

Use v-model on child components for parent child component communication

vue文档关于如何在自定义组件上使用v-model

In simple terms, the value bound by v-model on the custom component will be passed to the props: value in the child component, and it will automatically listen to the input event of the custom component, and the value returned by the input event will be automatically assigned to the value bound to the custom component in the parent component