nonebot2/docs/.vuepress/enhanceApp.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-06-30 04:10:57 +00:00
/**
* Client app enhancement file.
*
* https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements
*/
2020-09-17 05:12:48 +00:00
import Vuetify from "vuetify";
import "vuetify/dist/vuetify.min.css";
2020-06-30 04:10:57 +00:00
export default ({
Vue, // the version of Vue being used in the VuePress app
options, // the options for the root Vue instance
router, // the router instance for the app
siteData // site metadata
}) => {
2020-09-17 05:12:48 +00:00
Vue.use(Vuetify);
options.vuetify = new Vuetify({
icons: {
iconfont: "fa",
values: {
//
}
}
});
2020-08-20 07:07:05 +00:00
if (typeof process === "undefined" || process.env.VUE_ENV !== "server") {
router.onReady(() => {
const { app } = router;
app.$once("hook:mounted", () => {
// temporary fix for https://github.com/vuejs/vuepress/issues/2428
setTimeout(() => {
const { hash } = document.location;
if (hash.length > 1) {
2020-09-17 05:12:48 +00:00
const id = decodeURI(hash.substring(1));
2020-08-20 07:07:05 +00:00
const element = document.getElementById(id);
if (element) element.scrollIntoView();
}
}, 500);
});
});
}
};