Skip to content

Commit db681c8

Browse files
committed
[layui]adjust
1 parent 5bdccc4 commit db681c8

File tree

4 files changed

+295
-19
lines changed

4 files changed

+295
-19
lines changed

_formily/demo.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
import {FormButtonGroup, LifeCycleTypes, Reset, SchemaForm, SchemaMarkupField as Field, Submit} from '@formily/antd'
4+
import Printer from '@formily/printer'
5+
import {Input, Select} from '@formily/antd-components' // 或者@formily/next-components
6+
import 'antd/dist/antd.css'
7+
8+
const components = {
9+
Input,
10+
Select
11+
}
12+
13+
const App = () => {
14+
return (
15+
<Printer>
16+
<SchemaForm
17+
labelCol={5}
18+
wrapperCol={14}
19+
components={components}
20+
effects={($, {setFieldState}) => {
21+
$(LifeCycleTypes.ON_FORM_INIT).subscribe(() => {
22+
setFieldState('aa', state => {
23+
state.value = 321
24+
})
25+
})
26+
$(LifeCycleTypes.ON_FIELD_VALUE_CHANGE, 'aa').subscribe(
27+
fieldState => {
28+
setFieldState('bb', state => {
29+
state.visible = fieldState.value === 123
30+
})
31+
}
32+
)
33+
}}
34+
>
35+
<Field
36+
type="string"
37+
title="AA"
38+
enum={[
39+
{label: '123', value: 123},
40+
{label: '321', value: 321}
41+
]}
42+
name="aa"
43+
x-component="Select"
44+
/>
45+
<Field type="string" title="BB" name="bb" x-component="Input"/>
46+
<FormButtonGroup offset={5}>
47+
<Submit>查询</Submit>
48+
<Reset>重置</Reset>
49+
</FormButtonGroup>
50+
</SchemaForm>
51+
</Printer>
52+
)
53+
}
54+
55+
ReactDOM.render(<App/>, document.getElementById('root'))

config/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ export default {
3333
// entry: './_crud/final-form/*.js',
3434
// entry: './_crud/validate/*.js',
3535
// entry: './_crud/uform/*.js',
36+
entry: './_formily/*.js',
3637

37-
// amis-测试
38+
// amis-测试
3839
// entry: './_amis/**/*.{js,tsx}',
3940

4041
// 地图
@@ -83,7 +84,7 @@ export default {
8384

8485
// fetch请求
8586
// entry: './_fetch/reqwest/*.js',
86-
entry: './_fetch/umi-request/*.js',
87+
// entry: './_fetch/umi-request/*.js',
8788
// entry: './_fetch/axios/*.js',
8889
// entry: './_fetch/swr/*.js',
8990

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"@elastic/eui": "^17.1.2",
1818
"@emotion/core": "^10.0.22",
1919
"@emotion/styled": "^10.0.23",
20+
"@formily/antd-components": "^1.2.8",
21+
"@formily/printer": "^1.2.8",
22+
"@formily/react": "^1.2.8",
23+
"@formily/react-schema-renderer": "^1.2.8",
2024
"@material-ui/core": "^4.7.0",
2125
"@material-ui/icons": "^4.5.1",
2226
"@material-ui/lab": "^4.0.0-alpha.33",

0 commit comments

Comments
 (0)