We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
目前我们提供了 routePrefetch 的配置,开启后,会对 Link 做基于 preload=intent 的处理,即基于意图当用户鼠标进来时做对应路由的 preload。
存在的问题:
1、功能太单一,参考 #12825 缺少 render、viewport 策略的支持 2、intent 没有做 timeout,所以一滑而过的也会做 preload
1、修改 routePreload 配置类型为 'intent' | 'render' | 'viewport' | true | false,为兼容老功能,true 即为 'intent',此为全局配置 2、允许用户通过 <Link preload="none|intent|render|viewport" /> 覆盖默认行为 3、intent 策略增加 timeout 操作,默认为 50,并允许通过 routePreloadTimeout 配置进行修改 4、render 策略在 useLayoutEffect 下做 5、viewport 策略用 IntersectionObserver 监听 Link 元素是否进入 viewport 来做,会有一定的兼容性问题,不过低版本浏览器就不做支持了(文档上说明)
<Link preload="none|intent|render|viewport" />
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
问题
目前我们提供了 routePrefetch 的配置,开启后,会对 Link 做基于 preload=intent 的处理,即基于意图当用户鼠标进来时做对应路由的 preload。
存在的问题:
1、功能太单一,参考 #12825 缺少 render、viewport 策略的支持
2、intent 没有做 timeout,所以一滑而过的也会做 preload
方案
1、修改 routePreload 配置类型为 'intent' | 'render' | 'viewport' | true | false,为兼容老功能,true 即为 'intent',此为全局配置
2、允许用户通过
<Link preload="none|intent|render|viewport" />
覆盖默认行为3、intent 策略增加 timeout 操作,默认为 50,并允许通过 routePreloadTimeout 配置进行修改
4、render 策略在 useLayoutEffect 下做
5、viewport 策略用 IntersectionObserver 监听 Link 元素是否进入 viewport 来做,会有一定的兼容性问题,不过低版本浏览器就不做支持了(文档上说明)
The text was updated successfully, but these errors were encountered: