How to use the @form-create/utils.errMsg function in @form-create/utils

To help you get started, we’ve selected a few @form-create/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xaboy / form-create / packages / core / src2 / factory / handler.js View on Github external
col: parseCol(rule.col),
        props: parseProps(rule.props),
        emitEvent: parseEmit(rule.field, rule.emitPrefix, rule.emit, vm),
        validate: parseArray(rule.validate),
        options: parseArray(rule.options)
    };

    // parseRule.event = extend(rule.event, parseRule.emitEvent);
    parseRule.on = parseOn(rule.on, parseRule.emitEvent);

    Object.keys(parseRule).forEach(k => {
        $set(rule, k, parseRule[k]);
    });

    if (!rule.field && !noVal) {
        console.error('规则的 field 字段不能空' + errMsg());
    }

    return rule;
}
github xaboy / form-create / packages / core / src / core / render.js View on Github external
renderTemplate(parser) {
        const {id, rule, key} = parser;
        if (Vue.compile === undefined) {
            console.error('使用的 Vue 版本不支持 compile' + errMsg());
            return [];
        }

        if (!this.renderList[id]) {
            let vm = rule.vm;
            if (isUndef(rule.vm))
                vm = new Vue;
            else if (isFunction(rule.vm))
                vm = rule.vm(this.$handle.getInjectData(rule));

            this.renderList[id] = {
                vm,
                template: Vue.compile(rule.template)
            };

        }
github xaboy / form-create / packages / core / src / core / handle.js View on Github external
if (_rule.__fc__) {
                parser = _rule.__fc__;

                if (parser.vm !== this.vm && !parser.deleted)
                    return console.error(`${_rule.type}规则正在其他的  中使用` + errMsg());
                parser.update(this);
                let rule = parser.rule;
                this.parseOn(rule);
                this.parseProps(rule);
            } else {
                parser = this.createParser(this.parseRule(_rule));
            }

            let children = parser.rule.children, rule = parser.rule;
            if (!this.notField(parser.field))
                return console.error(`${rule.field} 字段已存在` + errMsg());

            this.setParser(parser);

            if (!_rule.__fc__) {
                bindParser(_rule, parser);
            }
            if (isValidChildren(children)) {
                this.loadRule(children, true);
            }

            if (!child) {
                this.sortList.push(parser.id);
            }

            if (!this.isNoVal(parser))
                Object.defineProperty(parser.rule, 'value', {
github xaboy / form-create / packages / element-ui / src / fApi.js View on Github external
append: (rule, after) => {
            let fields = fc.fieldList, index = fields.indexOf(after);

            if (rule.field && fields.indexOf(rule.field) !== -1)
                return console.error(`${rule.field} 字段已存在` + errMsg());

            if (isUndef(after)) {
                index = fields.length;
            } else if (index === -1)
                return;
            fc.rules.splice(index + 1, 0, rule);

        },
        prepend: (rule, after) => {
github xaboy / form-create / packages / core / src2 / formCreate.js View on Github external
rules.map((_rule, index) => {
                if (child && isString(_rule)) return;

                if (!_rule.type)
                    return console.error('未定义生成规则的 type 字段' + errMsg());

                let rule = getRule(_rule), handler;

                if (_rule.__handler__) {
                    handler = _rule.__handler__;
                    if (handler.vm !== this.vm && !handler.deleted)
                        return console.error(`第${index + 1}条规则正在其他的  中使用` + errMsg());

                    handler.vm = this.vm;
                    handler.render.vm = this.vm;
                    handler.render.vNode.setVm(this.vm);

                    handler.refresh();
                } else {
                    handler = getComponent(this, rule);
                }
github xaboy / form-create / packages / core / src2 / factory / render.js View on Github external
parse(form) {
        let {type, rule, refName, key, noValue} = this.handler;
        if (type === 'template' && rule.template) {

            if (Vue.compile === undefined) {
                console.error('使用的 Vue 版本不支持 compile' + errMsg());
                return [];
            }

            if (isUndef(rule.vm)) rule.vm = new Vue;

            let vn = Vue.compile(rule.template, {}).render.call(rule.vm);
            if (vn.data === undefined) vn.data = {};
            extend(vn.data, rule);
            vn.key = key;
            return [vn];

        } else if (!noValue) {
            return form.makeComponent(this.handler.render);
        } else {
            rule.ref = refName;
            if (isUndef(rule.key))
github xaboy / form-create / packages / iview / src / components / frame / render.js View on Github external
valid(field) {
        if (field !== this.handler.field)
            throw new Error('无效的表单字段' + errMsg());
    }