From 0a24ffeb3eff074c8f11e9f94fdf2c2cb4929799 Mon Sep 17 00:00:00 2001 From: quanyawei <401863037@qq.com> Date: Fri, 10 Nov 2023 13:08:29 +0800 Subject: [PATCH] fix:小程序详情修改 --- uni_modules/uview-ui/components/u--form/u--form.vue | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/uni_modules/uview-ui/components/u--form/u--form.vue b/uni_modules/uview-ui/components/u--form/u--form.vue new file mode 100644 index 0000000..fdfc212 --- /dev/null +++ b/uni_modules/uview-ui/components/u--form/u--form.vue @@ -0,0 +1,78 @@ +<template> + <uvForm + ref="uForm" + :model="model" + :rules="rules" + :errorType="errorType" + :borderBottom="borderBottom" + :labelPosition="labelPosition" + :labelWidth="labelWidth" + :labelAlign="labelAlign" + :labelStyle="labelStyle" + :customStyle="customStyle" + > + <slot /> + </uvForm> +</template> + +<script> + /** + * ���������������������������������nvue������u-form���uni-app������������������u-form���nvue������������form������ + * ���������nvue���������������u--form���������������������u-form.vue��������������������������� + */ + import uvForm from '../u-form/u-form.vue'; + import props from '../u-form/props.js' + export default { + // #ifdef MP-WEIXIN + name: 'u-form', + // #endif + // #ifndef MP-WEIXIN + name: 'u--form', + // #endif + mixins: [uni.$u.mpMixin, props, uni.$u.mixin], + components: { + uvForm + }, + created() { + this.children = [] + }, + methods: { + // ������������������������������������������������������������������������������������������������������������������������������������ + setRules(rules) { + this.$refs.uForm.setRules(rules) + }, + validate() { + /** + * ������������������������������this.$parent���������������������u--form������������������������u-form + * ���������u-form������������������������������children������������������������������������������������������u-form������������ + * ������������������������������������������������u--form���children���������u-form������children + */ + // #ifdef MP-WEIXIN + this.setMpData() + // #endif + return this.$refs.uForm.validate() + }, + validateField(value, callback) { + // #ifdef MP-WEIXIN + this.setMpData() + // #endif + return this.$refs.uForm.validateField(value, callback) + }, + resetFields() { + // #ifdef MP-WEIXIN + this.setMpData() + // #endif + return this.$refs.uForm.resetFields() + }, + clearValidate(props) { + // #ifdef MP-WEIXIN + this.setMpData() + // #endif + return this.$refs.uForm.clearValidate(props) + }, + setMpData() { + this.$refs.uForm.children = this.children + } + }, + } +</script> -- Gitblit v1.8.0