ctx.page的options.icon应该填入什么

options.icon需要接收一个 MaybeRefOrGetter<string>?类型的参数,我尝试了填入svg的url,本地相对路径,html片段,但貌似都不起作用。这个参数应该填入什么才可以正常显示呢

2 个赞

好像要先注册的,然后再拿注册的名字填进去呀

2 个赞

不确定是不是最小代码,反正能用(
我没写过 vue

index.ts

import { icons } from '@koishijs/client'
import icon from './assets/NI-logo.vue'

icons.register('NI-logo', icon)

  ctx.page({
    name: 'Match Scouting',
    path: '/NI-Scouting-2025',
    icon: 'NI-logo',
    component: ScoutView,
    authority: 0
  })

NI-logo.vue

<template>
    <img class="k-icon" src="./logo.png" alt="NI Logo" />
</template>
2 个赞