Do you want to work on this issue?
You can request for a bounty in order to promote it!
Introducing `appConfig` and `pageConfig` #445
egoist posted onGitHub
Request for Comments
What problem does this feature solve?
You can use siteConfig
and themeConfig
in saber-config.js
to configure your app and those configurations are available as simple JSON data at both compile time (like saber-node.js and plugins) and runtime (app code like saber-browser.js or a component).
But what if you want to .. use something like a Vue component in the config? like:
// saber-config.js
module.exports = {
siteConfig: {
logo: require('./Logo.vue')
}
}
This doesn't work because we can't require a Vue component in Node.js process.
What does the proposed API look like?
I'm thinking about a siteConfig
equivalent :appConfig
but for runtime only. you can use it like this in your app code, like saber-browser.js
:
import appConfig from 'saber/app-config'
import Logo from './Logo.vue'
appConfig.set('logo', Logo)
// appConfig.get('logo')
For page-level config, you can use pageConfig
instead:
<script>
export default {
pageConfig: object,
pageConfig: (this: Vue) => object
}
</script>
It's kinda similar to how page transition
works.
This feature might be unnecessary if using a Vue component in the config is not common or it doesn't have other use cases.