运行环境:react+antd 。
直接 npm start 。
虽然运行成功,但是过程中报错:
LessError: error evaluating function `darken`: color.toHSL is not a function“
问题原因: 黑暗主题颜色不兼容
解决方法:
在路径:node_module --> antd --> lib --> style --> themes --> default.less
在444行(我的是444行) Table下添加三行代码
// Table // -- @table-header-bg: @background-color-light; @table-header-color: @heading-color; @table-header-sort-bg: @background-color-base; @table-body-sort-bg: rgba(0, 0, 0, 0.01);
添加完如下:
// Table // -- @table-header-sort-active-bg: darken(@table-header-bg, 3%); @table-header-filter-active-bg: darken(@table-header-sort-active-bg, 5%); @table-selection-column-width: 60px; @table-header-bg: @background-color-light; @table-header-color: @heading-color; @table-header-sort-bg: @background-color-base; @table-body-sort-bg: rgba(0, 0, 0, 0.01); @table-row-hover-bg: @primary-1; @table-selected-row-color: inherit;
重新npm start
没毛病