Commit f04b5e03 authored by Bill's avatar Bill

修改flex-layout问题

parent 54cfe19f
...@@ -85,10 +85,10 @@ export function render(oldRender:Function) { ...@@ -85,10 +85,10 @@ export function render(oldRender:Function) {
export function onRouteChange({ routes, matchedRoutes, location, action }) { export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log('onRouteChange') console.log('onRouteChange')
if (isDev) { // if (isDev) {
console.log('dev') // console.log('dev')
return; // return;
} // }
if (whiteLists.includes(location.pathname)) { if (whiteLists.includes(location.pathname)) {
return return
......
...@@ -2,7 +2,7 @@ import React from 'react'; ...@@ -2,7 +2,7 @@ import React from 'react';
import { Row, Col } from 'antd'; import { Row, Col } from 'antd';
import { SchemaField } from "@formily/antd"; import { SchemaField } from "@formily/antd";
const renderCol = (schema, isLast) => { const renderCol = (schema) => {
const { flexcol = {}, } = schema && schema['x-component-props'] || {}; const { flexcol = {}, } = schema && schema['x-component-props'] || {};
const flexProps = schema['x-flex-props'] || {} const flexProps = schema['x-flex-props'] || {}
return <Col {...flexcol} {...flexProps} key={schema.path}> return <Col {...flexcol} {...flexProps} key={schema.path}>
...@@ -10,12 +10,12 @@ const renderCol = (schema, isLast) => { ...@@ -10,12 +10,12 @@ const renderCol = (schema, isLast) => {
</Col> </Col>
} }
const FlexRowLayout = (props) => { const FlexRowLayout = (props) => {
const childProperties = props.schema.getOrderProperties() const childProperties = props.schema && props.schema.getOrderProperties()
const { justify = "start", align = "top" } = props.props['x-component-props'] || {} const { justify = "start", align = "top" } = props.props['x-component-props'] || {}
return ( return (
<Row justify={justify} align={align}> <Row justify={justify} align={align}>
{ {
childProperties.map((v, i, arr) => renderCol(v.schema, arr.length - 1 === i)) childProperties.map((v, i, arr) => renderCol(v.schema))
} }
</Row> </Row>
) )
...@@ -23,13 +23,13 @@ const FlexRowLayout = (props) => { ...@@ -23,13 +23,13 @@ const FlexRowLayout = (props) => {
FlexRowLayout.isVirtualFieldComponent = true FlexRowLayout.isVirtualFieldComponent = true
const FlexColumnLayoutStyle = { const FlexColumnLayoutStyle = {
'display': 'flex', 'display': 'flex',
'flexDirection': 'column' 'flexDirection': 'column'
} }
const FlexColumnLayout = (props) => { const FlexColumnLayout = (props) => {
const childProperties = props.schema.getOrderProperties() const childProperties = props.schema && props.schema.getOrderProperties();
console.log("childProperties", childProperties)
const { style } = props.props['x-component-props'] || {}; const { style } = props.props['x-component-props'] || {};
return ( return (
......
...@@ -44,9 +44,7 @@ const InfomationInfo = () => { ...@@ -44,9 +44,7 @@ const InfomationInfo = () => {
const columns = res.data.map((item) => ({label: item.name, value: item.id})); const columns = res.data.map((item) => ({label: item.name, value: item.id}));
setFormStatus("layout.columnId", "options", columns) setFormStatus("layout.columnId", "options", columns)
} }
// if(!preview) {
getColumn() getColumn()
// }
}, []) }, [])
useEffect(() => { useEffect(() => {
...@@ -55,10 +53,8 @@ const InfomationInfo = () => { ...@@ -55,10 +53,8 @@ const InfomationInfo = () => {
const labels = res.data.map((item) => ({label: item.name, value: item.id})); const labels = res.data.map((item) => ({label: item.name, value: item.id}));
setFormStatus("layout.labelIds", "dataSource", labels) setFormStatus("layout.labelIds", "dataSource", labels)
} }
// if(!preview) {
getLabels() getLabels()
// } }, [])
})
useEffect(() => { useEffect(() => {
const data = initialValues.data || {} const data = initialValues.data || {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment