reactjs - 如何在反应应用程序中的 INavLink 中呈现自定义图标(不是 Office UI Fabric 图标)
问题描述
我正在使用来自 office-ui-fabric-react 的 Nav 并使用此处的图标呈现导航栏https://docs.microsoft.com/en-us/javascript/api/office-ui-fabric-react/inavlink?view= office-ui-fabric-react-latest#icon。我的要求是在导航栏中呈现一些自定义图标。图标属性需要一个字符串,并且只能使用此处https://uifabricicons.azurewebsites.net/中的图标及其友好名称,
//Doesn't render icon
{
name: "App details",
url: "http://msn.com",
key: "key1",
target: "_blank"
icon : "SomeURL"(Some custom icon from the project)
}
//renders icon
{
name: "App details",
url: "http://msn.com",
key: "key1",
target: "_blank"
icon : "Documentation"(Any Friendly Name from above list of icons)
}
要求:需要在此处显示不属于列表的图标https://uifabricicons.azurewebsites.net/
解决方案
您可以尝试使用 onRenderLink 方法自定义链接的外观
https://developer.microsoft.com/en-us/fluentui#/controls/web/nav
推荐阅读
- python - 用于多进程python输出的类似屏幕的分屏
- sql - 在同一查询中选择特定时期的前 5 个最大高点和 5 分钟低点说过去 180 天和 30 天
- python - Spyder 4.0.0 Editor 和 pathlib.PurePath 将我的编辑器转换成随机的 html 代码
- firebase - com.google.firebase.database.DatabaseException:类 java.lang.Class 具有泛型类型参数,请改用 GenericTypeIndicator
- android-studio - 访问被拒绝查找属性“persist.vendor.log.tel_dbg”
- python - Python SMTPException,使用瓶子软木瓶插件
- pandas - 大熊猫中的分组求和和除法
- php - symfony 路由器在所有语言环境中匹配 url
- c++ - C++ Socket编程:网络低速分析
- firebase - 任务“:cloud_firestore:extractDebugAnnotations”执行失败