UNPKG

vuepress-theme-hope

Version:

A light vuepress theme with tons of features

44 lines 1.47 kB
import { isString } from "@vuepress/helper/client"; import { defineComponent, h, resolveComponent } from "vue"; import { useRoute } from "vuepress/client"; import AutoLink from "@theme-hope/components/base/AutoLink"; import { isActiveItem } from "@theme-hope/utils/isActiveItem"; import "../../styles/sidebar/sidebar-child.scss"; export default defineComponent({ name: "SidebarChild", props: { /** * Sidebar item config * * 侧边栏项目配置 */ config: { type: Object, required: true, }, }, setup(props) { const route = useRoute(); return () => isString(props.config.link) ? // If the item has link, render it as `<AutoLink>` h(AutoLink, { class: [ "vp-sidebar-link", { active: isActiveItem(route, props.config) }, ], config: { ...props.config, exact: true, }, }) : // If the item only has text, render it as `<p>` h("p", props, [ h(resolveComponent("VPIcon"), { icon: props.config.icon, sizing: "both", }), props.config.text, ]); }, }); //# sourceMappingURL=SidebarChild.js.map