WatchDataLoader #
兼容 VitePress 的写法:load() 先收到 watch 匹配到的文件,再收到上下文。
字段 #
watchstring | string[]
要监听的文件的 glob 模式,或一组模式。相对路径从加载器文件所在的位置算起。
load(watchedFiles: string[], context: DataLoaderContext): MaybePromise<T>
根据 watch 匹配到的文件的绝对路径生成数据。
options可选DataLoaderOptions
加载器的额外选项。
完整类型签名
TypeScript
interface WatchDataLoader<T = unknown> {
watch: string | string[]
load: (watchedFiles: string[], context: DataLoaderContext) => MaybePromise<T>
options?: DataLoaderOptions
}

评论