AICCOF / chatmoss-ui

ChatMoss 交互层开源代码
MIT License
271 stars 65 forks source link

npm run win 编译报错 #85

Closed lizhihongTest closed 1 year ago

lizhihongTest commented 1 year ago

npm run win 出现编译报错icon 的数据类型要改成 IconifyIcon | string

import { Icon ,IconifyIcon} from '@iconify/vue'

interface Props {
  icon: IconifyIcon | string
}
vite v4.2.1 building for win...
transforming (1997) node_modules\lodash-es\_getPrototype.jssrc/components/common/SvgIcon/index.vue:20:9 - error TS2322: Type 'string | undefined' is not assignable to type 'string | IconifyIcon'.
  Type 'undefined' is not assignable to type 'string | IconifyIcon'.

20   <Icon :icon="icon" v-bind="bindAttrs" />
           ~~~~~

  node_modules/@iconify/vue/dist/iconify.d.ts:259:5
    259     icon: IconifyIcon | string;
            ~~~~
    The expected type comes from property 'icon' which is declared here on type 'ComponentProps<DefineComponent<IconProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<...>, {}>>'
lizhihongTest commented 1 year ago

chatmoss-ui\src\hooks\useIconRender.ts 需要修改icon

import { IconifyIcon} from '@iconify/vue'
export const useIconRender = () => {
  interface IconConfig {
    icon : IconifyIcon | string
    color?: string
    fontSize?: number
  }
zhukunpenglinyutong commented 1 year ago

感谢马上查看

zhukunpenglinyutong commented 1 year ago

已经解决