Closed rockletz closed 2 years ago
+1
+1
+1 (https://github.com/NG-ZORRO/ng-zorro-antd/issues/6760 I had opened this issue before, but i still have same problem..)
Hey guys. Could you please create a minimal reproduction? We will look into this. Thanks!
Hello @rockletz. Please provide a online reproduction by forking this link https://stackblitz.com/edit/ng-zorro-antd-start or a minimal GitHub repository.
Issues labeled by Need Reproduce
will be closed if no activities in 7 days.
你好 @rockletz, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 stackblitz 或者提供一个最小化的 GitHub 仓库
被标记为 Need Reproduce
的 issue 7 天内未跟进将会被自动关闭。
Stackblitz may be not helpful here. You could upload a repo.
I found the reason for the bug.
When the project is updated to angular12 and ng-zorro-antd12. If the content of theme.less file is not updated, such a bug will appear.
So, update the content of theme.less file, it's no problem. theme.less
+1
上次我测试出来了
在引入ng-zorro-antd/ng-zorro-antd.less的时候
不重新引入 https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/style/themes/default.less 不会报错
假如重复引入 https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/style/themes/default.less 最新的 也不会报错
假如重复引入 https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/components/style/themes/default.less 以前zorro版本,就会报错
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. If you can provide more information, feel free to ping anyone of our maintainers to reopen this issue. Thank you for your contributions. --- 这个 issue 已经被自动关闭,因为您没有向我们提供更多的信息。仅凭目前的描述我们无法采取任 何行动,如果您能提供更多的信息请随时联系我们的开发人员重新打开这个 issue。 感谢您的贡献。
原来是这个原因啊
是因为 Less 在 v4 中将除法/
的解析规则变了:除法周围需要加上括号包裹。
v4 以前:
@var: xxx / xxx;
现在:
@var: (xxx / xxx);
自己定制主题的时候,一般是先引入组件库的,然后再重写一遍ng-zorro-antd
的主题变量来达到覆盖的目的,所以就是自己复制过来的主题变量没有同步修改。
@import '../node_modules/ng-zorro-antd/ng-zorro-antd.less';
@table-padding-vertical-md: @table-padding-vertical * 3 / 4;
@table-padding-horizontal-md: @table-padding-horizontal / 2;
@table-padding-vertical-sm: @table-padding-vertical / 2;
@table-padding-horizontal-sm: @table-padding-horizontal / 2;
改过来就好了:
@table-padding-vertical-md: (@table-padding-vertical * 3 / 4);
@table-padding-horizontal-md: (@table-padding-horizontal / 2);
@table-padding-vertical-sm: (@table-padding-vertical / 2);
@table-padding-horizontal-sm: (@table-padding-horizontal / 2);
这个问题因人而异,因为不是所有人(项目)都是复制全部主题变量来覆盖,导致难以发现,才以为是ng-zorro-antd
内部的问题,大部分人应该都是只重写其中几个主题变量,所以就不会有问题(除法问题)。
今天升级项目的时候遇到了这个问题,从@angular-devkit/build-angular
到ng-zorro-antd
,再到less/less-loader
,找了半天,蓦然回首,小丑竟是我自己?
特此记录一下,望后来者莫步后尘。
Reproduction link
https://stackblitz.com/edit/angular-ivy-jfxzab?file=package.json
Steps to reproduce
Upgrade to Angular 12.1
What is expected?
The project should compile correctly.
What is actually happening?