1.0.0-dev.1 • Published 6 years ago

menreiki-ext-autoscroll v1.0.0-dev.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

menreiki在路由变更时,自动将页面滚动到头部的扩展

安装

npm install menreiki-ext-autoscroll -S

使用配置

./src/config.js中,添加如下代码:

import autoScroll from 'menreiki-ext-autoscroll';
export const extensions = [
  autoScroll(),
];

默认情况下,该扩展不会开启任何效果,只有在./src/routes.js的各个路由配置中,添加属性autoScroll: true才会在导航到该路由之后触发

参数Options

参数请参考MDN scrollIntoView,注意对于不支持scrollIntoViewOptions的浏览器,默认会降级为参数true