Closed Trinovantes closed 3 years ago
Out of curiosity how would we inject into a component? Just have a function that takes Highlight.js instance as an argument and returns a component using that instance?
Out of curiosity how would we inject into a component? Just have a function that takes Highlight.js instance as an argument and returns a component using that instance?
You can pass options when you use the plugin:
app.use(hljsVuePlugin, {
hljs
})
Then access it in the plugin install function
install(app, { hljs }) {
app.component('highlightjs', component) // instead of component object itself, insert a factory function that uses the hljs instance
},
I'll write some tests later when I have more time