diff --git a/src/utils/generator/config.js b/src/utils/generator/config.js index 84d34fe..d3b4b52 100644 --- a/src/utils/generator/config.js +++ b/src/utils/generator/config.js @@ -421,8 +421,8 @@ export const selectComponents = [ style: { width: "100%" }, disabled: false, clearable: true, - format: "yyyy-MM-dd", - "value-format": "yyyy-MM-dd", + format: "YYYY-MM-DD", + "value-format": "YYYY-MM-DD", readonly: false, }, { @@ -447,8 +447,8 @@ export const selectComponents = [ "end-placeholder": "结束日期", disabled: false, clearable: true, - format: "yyyy-MM-dd", - "value-format": "yyyy-MM-dd", + format: "YYYY-MM-DD", + "value-format": "YYYY-MM-DD", readonly: false, }, { diff --git a/src/utils/generator/render.jsx b/src/utils/generator/render.jsx index 927ea45..51c408a 100644 --- a/src/utils/generator/render.jsx +++ b/src/utils/generator/render.jsx @@ -66,6 +66,7 @@ function mountSlotFiles(confClone, children) { if (childObjs) { Object.keys(childObjs).forEach((key) => { const childFunc = childObjs[key]; + console.log(childFunc); if (confClone.__slot__ && confClone.__slot__[key]) { children.push(childFunc(confClone, key)); } @@ -217,6 +218,7 @@ export default defineComponent({ render() { const dataObject = makeDataObject(); const confClone = deepClone(this.$props.conf); + console.log(this.$slots.default, "lot"); const children = []; // 如果slots文件夹存在与当前tag同名的文件,则执行文件中的代码 mountSlotFiles(confClone, children); @@ -225,16 +227,29 @@ export default defineComponent({ // 将json表单配置转化为vue render可以识别的 “数据对象(dataObject)” buildDataObject.call(this, confClone, dataObject); - console.log(dataObject); const Tag = formComponentsMap[this.$props.conf.__config__.tag]; + + // return h(Tag, dataObject.attrs, children); return ( - - {children} - + <> + {children.length > 0 ? ( + + {children} + + ) : ( + + )} + + + // ); }, // render() { diff --git a/src/views/tool/build/DraggableItem.jsx b/src/views/tool/build/DraggableItem.jsx index de04822..77e3613 100644 --- a/src/views/tool/build/DraggableItem.jsx +++ b/src/views/tool/build/DraggableItem.jsx @@ -37,14 +37,15 @@ const components = { const layouts = { colFormItem( // h, - currentItem - // index, - // list + currentItem, + index, + list ) { const { onActiveItem } = this.$attrs; const config = currentItem.__config__; // console.log(arguments, "argu"); const child = renderChildren.apply(this, arguments); + let className = this.activeId === config.formId ? "drawing-item active-from-item" @@ -81,7 +82,9 @@ const layouts = { // config.defaultValue = event; }} > - {child} + {{ + default: child, + }} {components.itemBtns.apply(this, arguments)} @@ -90,9 +93,9 @@ const layouts = { }, rowFormItem( // h, - currentItem - // index, - // list + currentItem, + index, + list ) { const { onActiveItem } = this.$attrs; const config = currentItem.__config__; @@ -141,13 +144,9 @@ const layouts = { {{ item: ({ element, index }) => { const layout = layouts[element.__config__.layout]; + console.log(element, "element"); if (layout) { - return layout.call( - this, - element, - index, - element.__config__.children - ); + return layout.call(this, element, index, config.children); } return layoutIsNotFound.call(this); }, @@ -160,9 +159,9 @@ const layouts = { }, raw( // h, - currentItem - // index, - // list + currentItem, + index, + list ) { const config = currentItem.__config__; const child = renderChildren.apply(this, arguments); @@ -171,9 +170,6 @@ const layouts = { key={config.renderKey} conf={currentItem} onInput={(event) => { - // console.log(event, "oninput"); - // // this.$set(config, "defaultValue", event); - // // console.log(this.currentItem.__config__.defaultValue); this.currentItem.__config__.defaultValue = event; }} > @@ -185,9 +181,9 @@ const layouts = { function renderChildren( // // h, - currentItem - // // index, - // // list + currentItem, + index, + list ) { const config = currentItem.__config__; // // console.log(config, "config");