We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
// 自定义了一个生成组件的方法 可以通过传参批量生成组件 createTag(icon, label, name) { const tag = { icon: icon, label: label, name: name, rule() { console.log(label); return { type: name, field: Math.random(), title: label, info: '', effect: { fetch: '', }, value: '', props: {}, options: [ {value: '1', label: '选项1'}, {value: '2', label: '选项2'}, ] }; }, props() { return [ FcDesigner.makeOptionsRule('options'), { type: 'switch', field: 'type', title: '按钮类型', props: { activeValue: 'button', inactiveValue: 'default' }, }, { type: 'switch', field: 'disabled', title: '是否禁用' }, { type: 'inputNumber', field: 'min', title: '输入的最小长度', }, { type: 'inputNumber', field: 'max', title: '输入的最大长度', } ]; }, }; return tag; }
// 这块是应用
// data里的数据 singleTag: [ { icon: 'icon-input', label: '主题', name: 'input', }, { icon: 'icon-select', label: '描述', name: 'select', }, { icon: 'icon-input', label: '备注', name: 'input', } ],
//生成组件 const singleTags = this.singleTag.map(i => { return this.createTag(i.icon, i.label, i.name); }); singleTags.forEach(tag => { this.$refs.designer.addComponent(tag); this.$refs.designer.appendMenuItem('group1', { icon: tag.icon, name: tag.name, label: tag.label, }); }); 按道理生成的每个组件的title都不一样,但现实是只要用的是同一种组件 ,比如说主题和备注这两个都用的是input组件 他俩的标题就会变成一样的 都是备注 连原来菜单里的输入框标题都变成了备注。我不理解的是每创建一个组件都会有对应的rule,为什么还会被覆盖,请求解答,万分感谢。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
// 自定义了一个生成组件的方法 可以通过传参批量生成组件
createTag(icon, label, name) {
const tag = {
icon: icon,
label: label,
name: name,
rule() {
console.log(label);
return {
type: name,
field: Math.random(),
title: label,
info: '',
effect: {
fetch: '',
},
value: '',
props: {},
options: [
{value: '1', label: '选项1'},
{value: '2', label: '选项2'},
]
};
},
props() {
return [
FcDesigner.makeOptionsRule('options'),
{
type: 'switch',
field: 'type',
title: '按钮类型',
props: { activeValue: 'button', inactiveValue: 'default' },
},
{ type: 'switch', field: 'disabled', title: '是否禁用' },
{
type: 'inputNumber',
field: 'min',
title: '输入的最小长度',
},
{
type: 'inputNumber',
field: 'max',
title: '输入的最大长度',
}
];
},
};
return tag;
}
// 这块是应用
// data里的数据
singleTag: [
{
icon: 'icon-input',
label: '主题',
name: 'input',
},
{
icon: 'icon-select',
label: '描述',
name: 'select',
},
{
icon: 'icon-input',
label: '备注',
name: 'input',
}
],
//生成组件
const singleTags = this.singleTag.map(i => {
return this.createTag(i.icon, i.label, i.name);
});
singleTags.forEach(tag => {
this.$refs.designer.addComponent(tag);
this.$refs.designer.appendMenuItem('group1', {
icon: tag.icon,
name: tag.name,
label: tag.label,
});
});
按道理生成的每个组件的title都不一样,但现实是只要用的是同一种组件 ,比如说主题和备注这两个都用的是input组件 他俩的标题就会变成一样的 都是备注 连原来菜单里的输入框标题都变成了备注。我不理解的是每创建一个组件都会有对应的rule,为什么还会被覆盖,请求解答,万分感谢。
The text was updated successfully, but these errors were encountered: