导航
监听url的变化
监听当前位置的更改:
const onLocationChanged = (location) => {
console.log(location.pathname);
console.log(location.query);
console.log(location.hash);
};
module.exports = GitBook.createPlugin({
init: (dispatch, getState, { Navigation }) => {
dispatch(Navigation.listen(onLocationChanged));
}
});
插件初始状态时onLocationChanged
将被触发。
更改网址
作者: 雪之梦技术驿站
链接: https://snowdreams1006.github.io/gitbook-official/zh/api/navigation.html
来源: 雪之梦技术驿站
本文原创发布于「雪之梦技术驿站」,转载请注明出处,谢谢合作!