可以通过如下方式设置Image作为图标示例代码 NavigationMenus() { Image($r('app.media.ic_contact_us')) .width(24) .height(24).margin({ top: 16, right: 16 }).onClick(() => { }) } Navigation() { } .vertical(false) .scrollable(true) .barMode(BarMode.Scrollable) .barHeight(56) .onChange((index: number) => { console.info(index.toString()) }) .margin({ left: 16, right: 16 }) } .backgroundColor($r("sys.color.ohos_id_color_sub_background")) .title('附近门店') .width('100%') .titleMode(NavigationTitleMode.Mini) .menus(this.NavigationMenus)
可以通过如下方式设置Image作为图标
示例代码