File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
packages/components/src/ProForm Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -493,7 +493,10 @@ import React from 'react';
493493import { ProForm ,useForm } from ' @uiw-admin/components'
494494import { Button } from ' uiw'
495495const Demo = () => {
496- const [state ,setState ] = React .useState ({})
496+ const [state ,setState ] = React .useState ({
497+ input: ' ' ,
498+ upload: []
499+ })
497500 const form = useForm ()
498501
499502 return (
@@ -507,14 +510,23 @@ const Demo = () => {
507510 label: ' input' ,
508511 key: ' input' ,
509512 widget: ' input' ,
510- initialValue: ' ' ,
513+ initialValue: state . input ,
511514 widgetProps: {},
512515 span: " 24" ,
513516 required: true ,
514517 rules: [
515518 { pattern: new RegExp (/ [1][3][0-9 ] {9} $ / ), message: " 请输入正确手机号" },
516519 ]
517520 },
521+ {
522+ label: ' upload' ,
523+ key: ' upload' ,
524+ widget: ' upload' ,
525+ initialValue: state .upload ,
526+ widgetProps: {
527+ uploadType: ' card' ,
528+ },
529+ },
518530 ]}
519531 / >
520532 < Button
@@ -547,8 +559,14 @@ const Demo = () => {
547559 style= {{ marginTop: 10 ,width: 80 }}
548560 type= " primary"
549561 onClick= {()=> {
550- form .setFields ({input: ' 1234' })
551- setState ({input: ' 1234' })
562+ form .setFields ({
563+ input: ' 1234' ,
564+ upload: [ { dataURL: ' https://avatars2.githubusercontent.com/u/1680273?s=40&v=4' , name: ' uiw.png' }]
565+ })
566+ setState ({
567+ input: ' 1234' ,
568+ upload: [ { dataURL: ' https://avatars2.githubusercontent.com/u/1680273?s=40&v=4' , name: ' uiw.png' }]
569+ })
552570 } }
553571 >
554572 设置
You can’t perform that action at this time.
0 commit comments