在ng-alain中,使用ng-zorro圖標(biāo)庫,發(fā)現(xiàn)部分能正常顯示,部分并不能顯示,在控制臺(tái)同時(shí)發(fā)現(xiàn)出錯(cuò)報(bào)錯(cuò)。
ERROR Error: [@ant-design/icons-angular]: the icon redo-o does not exist or is not registered.
at IconNotFoundError (ant-design-icons-angular.js:159)
at MapSubscriber.project (ant-design-icons-angular.js:343)
...
出現(xiàn)以上問題是沒有對(duì)相對(duì)的圖標(biāo)進(jìn)行導(dǎo)入,并導(dǎo)出。
ng-alain默認(rèn)只導(dǎo)入了圖標(biāo)庫的幾十個(gè)圖標(biāo),在 style-icons-auto.ts可進(jìn)行查看。
因此可以參考style-icons-auto.ts,把你所需要的圖標(biāo)進(jìn)行import and export
ng-zorro圖標(biāo)庫:https://ng.ant.design/compone...
PS:下面看下ng-zorro等組件默認(rèn)樣式的修改
在項(xiàng)目中修改ng-zorro組件默認(rèn)樣式的一些方法:
類名等 前加::ng-deep; 類名等 前加:root; 類名等 前加:host /deep/;::ng-deep .ant-spin-dot i { background-color: #4c7bff;}:host ::ng-deep .ant-spin-dot i { background-color: #4c7bff;}:root .ant-select-dropdown { background-color: #1F273E; font-size: 14px; margin-top: 16px;}:host /deep/ .ant-spin-dot i { background-color: #4c7bff;}注意:上面三種方法可分別嘗試一下,不同情況下其中之一會(huì)生效。
截止目前最新的7.0.0-rc.0 版本
table組件tbody中的td中的內(nèi)容超出時(shí)默認(rèn)會(huì)換行,想要實(shí)現(xiàn)xxxx...的效果需要一個(gè)hack:
::ng-deep .ant-table-tbody > tr > td { max-width: 0; white-space: nowrap;}總結(jié)
以上所述是小編給大家介紹的Angular中使用ng-zorro圖標(biāo)庫部分圖標(biāo)不能正常顯示,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)錯(cuò)新站長站網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!
新聞熱點(diǎn)
疑難解答
圖片精選