1、modalForm表单每次点开显示的重复
这个问题可能是你没有给模态框加一个随机的key
如果加上key之后每次点击出来的模态框就是一个新的和上次无关
2、树形选择数据结构
const cascaderOptions = [
{
label: '综合管理中心',
value: 'fe',
children: [
{label: '运营部',value: 'js'}, {label: '技术部',value: 'ts'},
],
},
];
3、select下拉框
const statusList = [{label:'无效',value:'0'},{label:'有效',value:'1'}];
{
title: '状态',
dataIndex: 'status',
fieldProps: { options: statusList},
valueType: 'select',
render: (_, record) => [
<Tag color={record.value == 1 ? 'blue' : 'magenta'} key="subscribeAlert">
{statusList[record.value]}
</Tag>,
],
},
4、表单横向
<ProForm layout="horizontal">
可能遇到的失效原因:ProForm大小写拼写错误、Form表单进行了嵌套
5、下拉框默认值
initialValue={userInfo?.parentIds?.slice(3,userInfo?.parentIds.length-1)?userInfo?.parentIds?.slice(3,userInfo?.parentIds.length-1)?.split('/')?.map(Number):''}
6、preview提示开开浏览器js权限:请求接口路径问题,看看接口路径拼对了没
7.未知报错 删掉umi文件重启
mf-va_remoteEntry.js:717 Uncaught (in promise) Error: Module “./D:/desktop/gitee/dayun-antd-react/node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2” does not exist in container.
while loading “./D:/desktop/gitee/dayun-antd-react/node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2” from webpack/container/reference/mf
8、react中将数据存放在缓存中的方法和将数据从缓存中取出的方法
localStorage.setItem('user',values.username);
localStorage.getItem('user');
9、左侧菜单不展示某个页面
hideInMenu:true
10、Ref
actionRef.current.reload(); //刷新
formRef.current.getFieldsValue(true) //获取formRef的value
formRef.current?.setFieldsValue(info) //把info赋值给formRef
formRef.current?.validateFieldsReturnFormatValue?.() .then((values) => {
//校验完毕并返回values
})
.catch((errorInfo) => {
message.error('请将表单填写完整', 2.5);
});
11、element.nodeName.toLowerCase is not a function
有节点命名成了nodeName,这会有冲突,改个名字就好了