ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.29k stars 1.36k forks source link

🧐[问题]ProForm当字段验证正确后点击提交没有反应 #2870

Closed elainezhou0419 closed 3 years ago

elainezhou0419 commented 3 years ago

ProForm当字段验证正确后点击提交没有反应 当字段错误的时候,点击提交会触发验证,当所有字段都正确的时候,点击按钮就没有任何反应。 控制台也没有报错和输出任何内容。 这种情况怎么测试哪里出错了。 版本是最新的proform ` <ProForm

  submitter={{
    render: (_, dom) => (
      <FooterToolbar>
        <Button onClick={saveAsPDF}>保存图纸</Button>
        {dom}
      </FooterToolbar>
    ),
  }}
  onFinish={async (value) => {
    let success;
    if (objectValues.id) {
      success = await handleUpdate({ id: initialValues.id, ...value });
    } else {
      success = await handleAdd({ ...value });
    }
    console.log(value); // 这里没有控制台没有打印出任何内容
    console.log(success);
    if (success) {
      history.push('/design/list');
      return true;
    }
    console.log('i am here');
    return false;
  }}
  onFinishFailed={(errorInfo) => {
    console.log(errorInfo);
  }}
  initialValues={initialValues}
  requiredMark="optional"
  formRef={formRef}
>

`

hemengke1997 commented 3 years ago

动画6

用了一个demo,无法复现你这个情况诶,可以尝试先注释掉业务代码

elainezhou0419 commented 3 years ago

动画6

用了一个demo,无法复现你这个情况诶,可以尝试先注释掉业务代码

注释掉了点击提交按钮也没有反应。 cmd 有这些警告 WARNING Compiled with 4 warnings 18:13:01

warning in ./node_modules/@antv/algorithm/es/dijkstra.js

"export '__spreadArray' was not found in 'tslib'

warning in ./node_modules/@antv/algorithm/es/dijkstra.js

"export '__spreadArray' was not found in 'tslib'

warning in ./node_modules/@antv/algorithm/es/gaddi.js

"export '__spreadArray' was not found in 'tslib'

warning in ./node_modules/@antv/algorithm/es/gaddi.js

"export '__spreadArray' was not found in 'tslib'

版本依赖如下:

"dependencies": { "@ant-design/charts": "^1.1.4", "@ant-design/icons": "^4.5.0", "@ant-design/pro-card": "^1.13.0", "@ant-design/pro-descriptions": "^1.7.13", "@ant-design/pro-form": "^1.26.0", "@ant-design/pro-layout": "^6.19.1", "@ant-design/pro-table": "^2.39.0", "@umijs/openapi": "^1.1.14", "@umijs/plugin-openapi": "^1.2.0", "@umijs/route-utils": "^1.0.36", "antd": "^4.15.0", "classnames": "^2.2.6", "html2canvas": "^1.0.0-rc.7", "jspdf": "^2.3.1", "konva": "^8.0.1", "lodash": "^4.17.11", "moment": "^2.25.3", "omit.js": "^2.0.2", "qs": "^6.10.1", "rc-queue-anim": "^1.8.5", "rc-texty": "^0.2.0", "react": "^17.0.0", "react-dev-inspector": "^1.1.1", "react-dom": "^17.0.0", "react-helmet-async": "^1.0.4", "react-konva": "^17.0.2-0", "umi": "^3.4.0", "umi-request": "^1.0.8" }, "devDependencies": { "@ant-design/pro-cli": "^2.0.2", "@types/classnames": "^2.2.7", "@types/express": "^4.17.0", "@types/history": "^4.7.2", "@types/jest": "^26.0.0", "@types/lodash": "^4.14.144", "@types/qs": "^6.5.3", "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "@types/react-helmet": "^6.1.0", "@umijs/fabric": "^2.5.2", "@umijs/plugin-blocks": "^2.0.5", "@umijs/plugin-esbuild": "^1.0.1", "@umijs/preset-ant-design-pro": "^1.2.0", "@umijs/preset-react": "^1.7.4", "@umijs/yorkie": "^2.0.3", "carlo": "^0.9.46", "chalk": "^4.0.0", "cross-env": "^7.0.0", "cross-port-killer": "^1.1.1", "detect-installer": "^1.0.1", "enzyme": "^3.11.0", "eslint": "^7.1.0", "express": "^4.17.1", "gh-pages": "^3.0.0", "jsdom-global": "^3.0.2", "lint-staged": "^10.0.0", "mockjs": "^1.0.1-beta3", "prettier": "^2.0.1", "puppeteer-core": "^8.0.0", "stylelint": "^13.0.0", "typescript": "^4.3.2" },

github-actions[bot] commented 3 years ago

Hello @elainezhou0419. Please provide a online reproduction by forking this link https://codesandbox.io/ or a minimal GitHub repository.

你好 @elainezhou0419, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。

elainezhou0419 commented 3 years ago

把objectValues.id改成objectValues?.id 就没问题了。谢谢