Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
init() {
let handler = this.handler;
this.uploadOptions = extend({...this.options.upload}, this.handler.rule.props);
this.issetIcon = this.uploadOptions.allowRemove || this.uploadOptions.handleIcon;
this.propsData = this.vData.props(this.uploadOptions).class('fc-upload-con', true)
.props('onSuccess', (...args) => this.onSuccess(...args))
// .props('onRemove', (...args) => this.onRemove(...args))
.ref(handler.refName).key(`fip${handler.unique}`).get();
}
init() {
let props = this.rule.props;
$set(props, 'defaultFileList', []);
if (isUndef(props.showUploadList)) $set(props, 'showUploadList', false);
if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');
if (props.maxLength === undefined) $set(props, 'maxLength', 0);
if (props.action === undefined) $set(props, 'action', '');
if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);
if (!props.modalTitle) $set(props, 'modalTitle', '预览');
$set(this.rule, 'value', parseValue(this.rule.value));
this.parseValue = [];
}
init() {
this.parseValue = [];
const props = this.rule.props;
props.fileList = [];
props.showFileList = false;
if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');
if (!props.modalTitle) $set(props, 'modalTitle', '预览');
if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);
$set(this.rule, 'value', parseValue(this.rule.value));
}
init() {
let rule = this.rule;
if (!rule.props.data) $set(rule.props, 'data', []);
if (!rule.props.options) $set(rule.props, 'options', []);
if (!Array.isArray(this.rule.value)) $set(rule, 'value', []);
}
init() {
let props = this.rule.props;
$set(props, 'defaultFileList', []);
if (isUndef(props.showUploadList)) $set(props, 'showUploadList', false);
if (isUndef(props.uploadType)) $set(props, 'uploadType', 'file');
if (props.maxLength === undefined) $set(props, 'maxLength', 0);
if (props.action === undefined) $set(props, 'action', '');
if (props.uploadType === 'file' && isUndef(props.handleIcon)) $set(props, 'handleIcon', false);
if (!props.modalTitle) $set(props, 'modalTitle', '预览');
$set(this.rule, 'value', parseValue(this.rule.value));
this.parseValue = [];
}
getValue(field) {
const handler = fc.handlers[field];
if (isUndef(handler)) return;
let val = undefined;
if (handler.noValue === true)
handler.$emit('input', (v) => {
val = v;
}, this);
else
val = deepExtend({}, {value: vm._value(field)}).value;
return val;
},
setValue(field, value) {
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)
};
}
const {vm, template} = this.renderList[id];
setTemplateProps(vm, parser, this.$handle.fCreateApi);
vm.$off('input');
export function getFileName(pic) {
return toString(pic).split('/').pop()
}
function getFileName(file) {
return toString(file).split('/').pop()
}