-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
consider support vue data through config globally #752
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
Comments
We can also pass the whole object: window.__EXECUTE_RESULT__ = new window.Vue(this.config.vueOptions).$mount('#main') This should be even more flexible, right? |
I don't see Current This feature could make some data re-usable across all pages within the HTML (f.e. window.$docsify = {
vueOptions: { author: 'Recking Wan' }
} Sidenote, The code in that conditional block is very bad. The I have a pull request coming to fix this soon. The change can currently be seen here, though I will revise it and add unit tests. |
@trusktr -- With #1271 now complete, adding the ability to pass data to Vue instances would be really helpful. Keep in mind that if we have only one Vue configuration, then that configuration will be shared across all Vue instances that docsify auto-instantiates. We can allow for multiple Vue configurations, accessible using CSS selectors as keys, so that configurations can be applied to individual elements: window.$docsify = {
vueData: {
// Pass this data to elements with id="my-container"
'#my-container': {
// ...
},
// Pass this data to <my-component> elements
'my-component': {
// ...
},
// Pass to an element that does not match once of the above keys / selectors
'*': {
// ...
}
}
} Since docsify adds the current page name to the window.$docsify = {
vueData: {
// Pass this data to elements with id="my-container" on README.md
'body[data-page="README.md"] #my-container': {
// ...
},
// Pass this data to elements with id="my-container" on configuration.md
'body[data-page="configuration.md"] #my-container': {
// ...
},
}
} Thoughts? |
maybe we can change this line of code:
docsify/src/core/render/index.js
Line 60 in 1a945d4
to include data from config file, code may like this:
The text was updated successfully, but these errors were encountered: