fix(theme): missing global properties in localSearch (#2396)

pull/2399/head
烽宁 2 years ago committed by GitHub
parent 8153f23c90
commit 489681117f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -161,6 +161,18 @@ debouncedWatch(
// Silence warnings about missing components // Silence warnings about missing components
app.config.warnHandler = () => {} app.config.warnHandler = () => {}
app.provide(dataSymbol, vitePressData) app.provide(dataSymbol, vitePressData)
Object.defineProperties(app.config.globalProperties, {
$frontmatter: {
get() {
return vitePressData.frontmatter.value
}
},
$params: {
get() {
return vitePressData.page.value.params
}
}
})
const div = document.createElement('div') const div = document.createElement('div')
app.mount(div) app.mount(div)
const sections = div.innerHTML.split(headingRegex) const sections = div.innerHTML.split(headingRegex)

Loading…
Cancel
Save