Chanzhaoyu / chatgpt-web

用 Express 和 Vue3 搭建的 ChatGPT 演示网页
MIT License
30.94k stars 11.2k forks source link

前端编译时报错 #2095

Open leyafo opened 2 weeks ago

leyafo commented 2 weeks ago

在项目根目录下运行:

pnpm install
pnpm build

scrollRef,


  src/views/chat/hooks/useScroll.ts:7:3
    7   scrollRef: Ref<ScrollElement>
The expected type comes from property 'scrollRef' which is declared here on type 'ScrollReturn'

仔细看了下代码,是vue的ref 和 Ref 转换的问题。

interface ScrollReturn {
  scrollRef: Ref<ScrollElement>
  scrollToBottom: () => Promise<void>
  scrollToTop: () => Promise<void>
  scrollToBottomIfAtBottom: () => Promise<void>
}
export function useScroll(): ScrollReturn {
  const scrollRef = ref<ScrollElement>(null)

定义的是大写的 Ref, 返回的是小写的 ref。

zlq54321 commented 1 week ago

试试 pnpm build-only