Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
}
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))
rule.key = 'def' + uniqueId();
let vn = this.vNode.make(type, {...rule}, this.childrenParse(form));
vn.key = key;
return [vn];
}
}
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)
.props('onSuccess', (...args) => this.onSuccess(...args))
.props('onRemove', (...args) => this.onRemove(...args))
.props('beforeUpload', (...args) => this.beforeUpload(...args))
.ref(handler.refName).key(`fip${handler.unique}`).get();
}
constructor(type, title, field, value, props = {}) {
super();
extend(this._data, baseRule());
extend(this._data, {type, title, field, value});
if (isPlainObject(props)) this.props(props);
}
VData.prototype[key] = function (obj, val) {
if (isUndef(obj)) return this;
if (isPlainObject(obj)) {
$set(this._data, key, extend(this._data[key], obj));
} else {
$set(this._data[key], toString(obj), val);
}
return this;
};
});
function parseOn(on, emitEvent) {
if (Object.keys(emitEvent).length > 0) extend(on, emitEvent);
return on;
}
export default function makerFactory() {
let maker = {};
const commonMaker = creatorFactory('');
extend(maker, {
create(type, field, title) {
let make = commonMaker('', field);
make._data.type = type;
make._data.title = title;
return make;
},
createTmp(template, vm, field, title) {
let make = commonMaker('', field);
make._data.type = 'template';
make._data.template = template;
make._data.title = title;
make._data.vm = vm;
return make;
}
});
maker.template = maker.createTmp;