docs: optimize sidebar style (#18842)

* docs: optimize sidebar style

* docs: update
This commit is contained in:
btea 2024-11-09 13:59:26 +08:00 committed by GitHub
parent a2ea613317
commit 03380de918
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,6 +13,7 @@ import SponsorRightLogoSmallList from '../sponsors/right-logo-small-list.vue'
const headers = useToc() const headers = useToc()
const lang = useLang() const lang = useLang()
const sponsor = computed(() => sponsorLocale[lang.value]) const sponsor = computed(() => sponsorLocale[lang.value])
const removeTag = (str: string) => str.replace(/<span.*<\/span>/g, '')
</script> </script>
<template> <template>
@ -26,7 +27,7 @@ const sponsor = computed(() => sponsorLocale[lang.value])
:href="link" :href="link"
:title="text" :title="text"
> >
<div v-html="text" /> <div :title="removeTag(text)" v-html="text" />
<template v-if="children" #sub-link> <template v-if="children" #sub-link>
<el-anchor-link <el-anchor-link
v-for="{ link: childLink, text: childText } in children" v-for="{ link: childLink, text: childText } in children"
@ -34,7 +35,7 @@ const sponsor = computed(() => sponsorLocale[lang.value])
:href="childLink" :href="childLink"
:title="text" :title="text"
> >
<div v-html="childText" /> <div :title="removeTag(childText)" v-html="childText" />
</el-anchor-link> </el-anchor-link>
</template> </template>
</el-anchor-link> </el-anchor-link>
@ -59,4 +60,11 @@ const sponsor = computed(() => sponsorLocale[lang.value])
width: 100%; width: 100%;
} }
} }
.el-anchor__item {
.el-anchor__link > div {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style> </style>