ant-design-vue icon indicating copy to clipboard operation
ant-design-vue copied to clipboard

The test environment is packaged. After the clearValidate of the form is executed, the class name is not cleared, resulting in style problems.

Open havenothingtosay opened this issue 3 years ago • 6 comments
trafficstars

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.2.8

Environment

vue 3.2.26

Reproduction link

Edit on CodeSandbox

Steps to reproduce

只有测试环境打包会出现该问题,本地和生产环境都没有问题(提供的在线链接没什么用,但是不提供无法提交)

  1. 表单不填写必填项,点击提交,触发提示信息,此时dom上会增加类名"ant-form-item-has-error ant-form-item-with-help"
  2. 调用clearValidate(),清空表单校验信息,但是类名只去掉了"ant-form-item-has-error",未去掉"ant-form-item-with-help",导致样式出现问题:margin-bottom: 0;表单项之间没有间距

image

What is expected?

能正确去除类名

What is actually happening?

类名没有完全清除,导致样式问题

havenothingtosay avatar Jun 20 '22 10:06 havenothingtosay

测试环境有各种 mock ,不要用测试环境打包

tangjinzhou avatar Jun 22 '22 01:06 tangjinzhou

测试环境有各种 mock ,不要用测试环境打包

好吧,因为在测试环境测试,所以才发现的这个问题。但是看起来也没什么办法改,就只能先这样了。感谢回答!

havenothingtosay avatar Jun 22 '22 01:06 havenothingtosay

测试环境是用来跑CI 测试用例的 ,你自己的业务测试环境应该是 production test

tangjinzhou avatar Jun 22 '22 02:06 tangjinzhou

测试环境是用来跑CI 测试用例的 ,你自己的业务测试环境应该是 production test

那请问组件库打包的时候是怎么区分的呢?对我传入的mode值有什么要求吗?我现在测试环境的打包命令是vite build --mode test,是因为test这个值让他按照测试来打包了吗?

havenothingtosay avatar Jun 22 '22 02:06 havenothingtosay

process.env.NODE_ENV === 'test'

tangjinzhou avatar Jun 23 '22 12:06 tangjinzhou

process.env.NODE_ENV === 'test'

换了一个mode值,问题解决了。非常感谢!

havenothingtosay avatar Jun 27 '22 02:06 havenothingtosay

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

github-actions[bot] avatar Aug 26 '22 04:08 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Sep 04 '23 00:09 github-actions[bot]