若在页面中使用表单校验
onReady() {
this.$refs.uForm.setRules(this.rules);
}
若在组件中使用表单校验
mounted() {
this.$refs.uForm.setRules(this.rules);
}
若在u-popup组件中使用表单校验
<u-popup v-model="show" mode="bottom">
<u-form :model="deviceData" ref="uForm"><u-form>
<u-popup>
isShow() {
this.show=true
this.$nextTick(function(){
this.$refs.uForm.setRules(this.rules);
})
},
页面生命周期与组件生命周期不同,若都使用onReady会导致H5或APP无法校验表单的情况