diff --git a/src/utils/generator/parser.jsx b/src/utils/generator/parser.jsx index 9f850a2..644fefd 100644 --- a/src/utils/generator/parser.jsx +++ b/src/utils/generator/parser.jsx @@ -18,10 +18,11 @@ const ruleTrigger = { }; const layouts = { - colFormItem(h, scheme) { + colFormItem(h, scheme, disabled) { + console.log(disabled); const config = scheme.__config__; const listeners = buildListeners.call(this, scheme); - console.log(listeners, "28"); + console.log(config, "28"); let labelWidth = config.labelWidth ? `${config.labelWidth}px` : null; if (config.showLabel === false) labelWidth = "0"; return ( @@ -31,13 +32,13 @@ const layouts = { prop={scheme.__vModel__} label={config.showLabel ? config.label : ""} > - + ); }, - rowFormItem(h, scheme) { - let child = renderChildren.apply(this, arguments); + rowFormItem(h, scheme, disabled) { + let child = renderChildren.apply(this, arguments, disabled); if (scheme.type === "flex") { child = ( - {renderFormItem.call(this, h, formConfCopy.fields)} + {renderFormItem.call( + this, + h, + formConfCopy.fields, + formConfCopy.disabled + )} {formConfCopy.formBtns && formBtns.call(this, h)} @@ -93,23 +99,23 @@ function formBtns(h) { ); } -function renderFormItem(h, elementList) { +function renderFormItem(h, elementList, disabled) { return elementList.map((scheme) => { const config = scheme.__config__; const layout = layouts[config.layout]; + console.log(layout); if (layout) { - console.log(layout); - return layout.call(this, h, scheme); + return layout.call(this, h, scheme, disabled); } throw new Error(`没有与${config.layout}匹配的layout`); }); } -function renderChildren(h, scheme) { +function renderChildren(h, scheme, disabled) { const config = scheme.__config__; if (!Array.isArray(config.children)) return null; - return renderFormItem.call(this, h, config.children); + return renderFormItem.call(this, h, config.children, disabled); } function setValue(event, config, scheme) { diff --git a/src/utils/generator/render.jsx b/src/utils/generator/render.jsx index 03022b5..3130a55 100644 --- a/src/utils/generator/render.jsx +++ b/src/utils/generator/render.jsx @@ -17,7 +17,7 @@ import { ElCheckboxGroup, } from "element-plus"; import Editor from "@/components/Editor"; -import { h, defineComponent } from "vue"; +import { h, defineComponent, readonly } from "vue"; const formComponentsMap = { "el-row": ElRow, @@ -171,6 +171,9 @@ export default defineComponent({ type: Object, required: true, }, + // noedit: { + // type: Boolean, + // }, }, data() { return { @@ -237,6 +240,11 @@ export default defineComponent({ ) : (