zoukankan      html  css  js  c++  java
  • vue form dynamic validator All In one

    vue form dynamic validator All In one

    vue 动态校验表单 All In one

    solutions ✅

    
        inventoryTypesChange (values = []) {
            if(!values?.length) {
                this.rules.inventoryTypes[0].required = true;
            } else {
                this.rules.inventoryTypes[0].required = false;
            }
            // 手动校验
            this.$emit('validate-field-by-key', 'inventoryTypes');
        },
    
    
    
        inventoryTypesChange (values = []) {
            console.log('values =', values);
            if(!values?.length) {
                // this.$message.error('至少选择一个媒体');
                // this.rules.inventoryTypes.message = '至少选择一个媒体';
                this.rules.inventoryTypes[0].required = true;
            } else {
                this.rules.inventoryTypes[0].required = false;
            }
            console.log('this.rules.inventoryTypes', this.rules.inventoryTypes);
            // 手动校验
            this.$nextTick(() => {
                this.$emit('validate-field-by-key', 'inventoryTypes');
            });
        },
    
    

    refs

    https://github.com/xgqfrms/vue/issues/199



    ©xgqfrms 2012-2020

    www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

    原创文章,版权所有©️xgqfrms, 禁止转载 ️,侵权必究⚠️!


    xgqfrms
  • 相关阅读:
    单点登录实现机制
    简单工厂
    单例模式
    Remoting
    Redis编码问题
    减少手机页面跳转的方法(转)
    失血模型,充血模型
    Hashtable
    Why we don’t recommend using List<T> in public APIs
    Aggregate累加器
  • 原文地址:https://www.cnblogs.com/xgqfrms/p/15529756.html
Copyright © 2011-2022 走看看