npm run serve 报错,但是能访问页面

来源:4-5 ColumnList 组件编码

雷神课

2021-03-17

Type checking in progress...

  App running at:
  - Local:   http://localhost:8080/ 
  - Network: http://192.168.1.238:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

ERROR in /Users/leishen/pro/o/2021/zheye/node_modules/@vue/runtime-core/dist/runtime-core.d.ts(1346,115):
1346:115 A rest element type must be an array type.
    1344 | export declare function warn(msg: string, ...args: any[]): void;
    1345 | 
  > 1346 | export declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
         |                                                                                                                   ^
    1347 | 
    1348 | export declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
    1349 | 
ERROR in /Users/leishen/pro/o/2021/zheye/src/components/createMessage.ts(14,29):
14:29 Expected 0 arguments, but got 1.
    12 |   messageInstance.mount(mountNode)
    13 |   setTimeout(() => {
  > 14 |     messageInstance.unmount(mountNode)
       |                             ^
    15 |     document.body.removeChild(mountNode)
    16 |   }, timeout)
    17 | }
Version: typescript 3.9.9
Time: 6382ms
写回答

1回答

张轩

2021-03-17

同学你好 由于课程的时候 vue 采用的是3.0.0 版本,现在vue 到了 3.0.4, 有些 API 有更改,messageInstance.unmount 方法不需要参数了,这里你把 unmount 中的 mountNode 删除掉就可以了。

0
0

Vue3 + TS 仿知乎专栏企业级项目

带你完成前后端分离复杂项目,率先掌握 vue3 造轮子技能

3223 学习 · 2373 问题

查看课程