-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] unfold 'details' container by default #291
Comments
// vuepress/client.ts
import { defineClientConfig, useRoute } from 'vuepress/client'
export default defineClientConfig({
setup() {
const route = useRoute()
onMounted() {
// Toggle all <details> open when path changes
watch(() => route.path, () => {
document.querySelectorAll('details').forEach((detail) => {
detail.open = true
})
}, { immediate: true })
})
},
}) |
@pengzhanbo I don't think it's worthy to be further worked on, RFC here. IMO, the goal of details is to hide some further explanations out of the main document to make the structure and content clean, while providing an easier way to access these further explanations rather than as attachement. |
@Mister-Hope I agree with this viewpoint. If the |
tks, it works! it should be the code below: setup() {
const route = useRoute()
onMounted(() => {
// Toggle all <details> open when path changes
document.querySelectorAll('details').forEach((detail) => {
detail.open = true
})
watch(() => route.path, () => {
setTimeout(() => {
document.querySelectorAll('details').forEach((detail) => {
detail.open = true
})
}, 200)
}, { immediate: true })
})
}, |
werid, I think my code should work as I am already asking the watcher to run immediately. |
Clear and concise description of the problem
now,details' container in @vuepress/plugin-markdown-hint is folded by default
need config entrance to let it be fold by default
Suggested solution
need config entrance to let it be fold by default
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: