You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

升级Kendo UI for Angular后出现SVG图标警告,如何消除该提示?

解决Kendo UI for Angular升级后图标类型警告问题

这个警告的核心原因是当前项目中图标默认类型被设置为svg,但你实际使用的是字体图标名称,框架因此抛出提示。要消除警告,可通过以下两种方式处理:

全局统一设置默认图标类型

在项目根模块(通常是app.module.ts)中,配置IconsModule时指定默认类型为font,这样所有图标组件都会默认使用字体图标,无需逐个修改:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IconsModule } from '@progress/kendo-angular-icons';

@NgModule({
  imports: [
    BrowserModule,
    IconsModule.forRoot({
      iconType: 'font'
    })
  ],
  declarations: [AppComponent],
  bootstrap: [AppComponent]
})
export class AppModule { }

单个组件显式指定图标类型

如果只需要修正部分组件的警告,直接在对应的<k-icon>标签上添加iconType="font"属性即可:

<k-icon name="home" iconType="font"></k-icon>

两种方式任选其一,都能彻底消除控制台的警告信息,同时保持字体图标正常显示。

内容的提问来源于stack exchange,提问作者ps0604

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 14:13:13