Giter VIP home page Giter VIP logo

form-create-designer's Issues

自定义组件

这个可以把自己自定义的一些组件放进去吗?

自定义组件这块遇到了点问题,希望指点一下

// 自定义了一个生成组件的方法 可以通过传参批量生成组件
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,为什么还会被覆盖,请求解答,万分感谢。

关于创建group拖拽组件

想在左侧的组件列表中添加group的组件按钮,但是group.js不知道怎么写。

const label = '数组组件';
const name = 'group';
export default {
icon: 'icon-group',
label,
name,
drag: true,
dragBtn: true,
rule() {
return {
field: uniqueId(),
title: label,
type: 'group',
props:{
rules: []
}
};
},
props() {
return [];
}
};
`
这样写没有办法向group里拖入其他组件。

designer联动数据问题

1.这个组件联动数据的作用是什么?
2.这个组件联动数据的格式怎么填?(在数组中填入任何都会报格式错误)

接口数据复用问题

请问如何实现表单加载时调用后端接口获取数据,并在表单中的多个组件中使用返回的数据?

setvalue为null值时会死循环

[
{
"info": "",
"link": [
""
],
"type": "input",
"field": "remainingAmount",
"props": {
"disabled": false,
"readonly": true
},
"title": "Remaining Amount",
"hidden": false,
"update": "[[FORM-CREATE-PREFIX-function update(val, rule, fApi) {\n console.log("循环")\n var totalAmount = fApi.getValue("totalAmount");\n var waivedAmount=fApi.getValue("waivedAmount");\n var m = null;\n fApi.setValue("remainingAmount",m)\n}-FORM-CREATE-SUFFIX]]",
"display": true,
"validate": [
{
"required": false
}
],
"_fc_drag_tag": "input"
}
]

fApi.setValue如果设置值为null会循环触发update,旧版本不会循环触发

删格布局的处理

可以参考form-generate的设计器,在每个组件的属性panel,进行定义
Screen Shot 2021-09-19 at 5 28 27 PM

有ant-design-vue的designer

“form-create-designer 是基于 @form-create/element-ui 实现的表单设计器组件。”

有基于ant-design-vue的designer吗?

组件的基础配置怎么增加

有一些定制化的东西希望加在基础配置中,请问是怎么增加呢
比如说加一个字段进去,是个输入框这样子的

setRule方法对于栅格布局会重复添加children

图片

1.[{"type":"FcRow","children":[{"type":"col","props":{"span":12},"children":[{"type":"input","field":"Foii5wsnacbrh","title":"输入框","info":"","_fc_drag_tag":"input","hidden":false,"display":true}],"_fc_drag_tag":"col","hidden":false,"display":true}],"_fc_drag_tag":"row","hidden":false,"display":true}]
2.[{"type":"FcRow","children":[{"type":"col","props":{"span":12},"children":[{"type":"DragTool","props":{"dragBtn":false,"mask":false},"effect":{"_fc_tool":true},"inject":true,"on":{},"children":[{"type":"DragBox","wrap":{"show":false},"col":{"show":false},"inject":true,"props":{"rule":{"props":{"tag":"el-col","group":"default","ghostClass":"ghost","animation":150,"handle":"._fc-drag-btn","emptyInsertThreshold":0,"direction":"vertical","itemKey":"type"}},"tag":"col"},"children":[{"type":"DragTool","props":{"dragBtn":false,"mask":false},"effect":{"_fc_tool":true},"inject":true,"on":{},"children":[{"type":"DragBox","wrap":{"show":false},"col":{"show":false},"inject":true,"props":{"rule":{"props":{"tag":"el-col","group":"default","ghostClass":"ghost","animation":150,"handle":"._fc-drag-btn","emptyInsertThreshold":0,"direction":"vertical","itemKey":"type"}},"tag":"col"},"children":[{"type":"DragTool","props":{"dragBtn":true,"mask":true},"effect":{"_fc_tool":true},"inject":true,"on":{},"children":[{"type":"DragTool","props":{"dragBtn":true,"mask":true},"effect":{"_fc_tool":true},"inject":true,"on":{},"children":[{"type":"input","field":"Foii5wsnacbrh","title":"输入框","info":"","_fc_drag_tag":"input","hidden":false,"display":true,"props":{},"on":{},"options":[],"children":[],"config":{"config":{"icon":"icon-input","label":"输入框","name":"input"}},"effect":{"_fc":true}}],"options":[],"hidden":false,"display":true}],"options":[],"hidden":false,"display":true}],"on":{},"options":[],"hidden":false,"display":true}],"options":[],"hidden":false,"display":true}],"on":{},"options":[],"hidden":false,"display":true}],"options":[],"hidden":false,"display":true}],"_fc_drag_tag":"col","hidden":false,"display":true,"on":{},"options":[],"config":{"config":{"name":"col","drag":true,"dragBtn":false,"inside":true,"mask":false}},"effect":{"_fc":true}}],"_fc_drag_tag":"row","hidden":false,"display":true,"props":{},"on":{},"options":[],"config":{"config":{"icon":"icon-row","label":"栅格布局","name":"row","mask":false,"children":"col"}},"effect":{"_fc":false},"_id":"Fygc5wsnc4lti"}]

多次调用setRule方法,栅格数据结构会变的越来越复杂

选择器加载异步数据token

fc-designer的选择器组件,在加载异步数据的时候怎么操作才能解决待token得问题???就是访问异步数据接口的时候能自带vue中的token??? 如: $store.user.token ,这种方式

请问这个

请问这个表单设计器后续会出基于ant-design-vue 版本的开发吗,今年上半年会出吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.