Here’s a quick way to use Vue plugins in Quasar.
Use Case: Frappe Charts in Vue
Let’s consider a simple use case for using Vue plugins - we want to use Frappe charts.
We can simply use vue2-frappe to easily do that. Just install the package in your project -
|
|
Next, register it as a Vue plugin -
|
|
Frappe in Quasar
In Quasar you can’t do a Vue.use
like the above. There is no main.js
to orchestrate that.
The documentation of vue2-frappe
does say that we can use vue2-frappe
directly in components..
|
|
.. but, I was never successful in getting that to work.
Time is always of essence - so I did the next best thing. I used a boot plugin to register Vue plugins.
Create ./src/boot/vplugins.js
.
|
|
Register this new plugin in quasar.conf
..
|
|
You can now happily use frappe charts from any component -
|
|
Have additional plugins to register? Instead of creating distinct files for more than one Vue plugin, we just combine everything in one file - just change vplugins.js
and you are all set.
|
|