Ah mixins is my headache π£ BUT Iβm recently learning the new Vue composition API which solves some of the concern of mixins, so cant wait to be able to use that!
In regards to plugins, can you expand more? So I know content to better create π
Yes of course, so for example in one of my early Vue projects where I had no idea what i was doing. I started writing a mixin which handles all of my HTTP requests to firebase.
I noticed in other projects , this was handled much better as plugin instead, this allowed for you to extend the Vue object, so you could do something like this.$http.get() or this.$http.post() etc inside a vue component. This seems a lot cleaner! It's left me wondering in which circumstance would a mixin be better choice over a plugin? like you said, perhaps mixins are going out the door with vue 3?
Ah gotcha! Thanks for clarifying! That's a good question -- I have been avoiding mixins so I'm not sure when it is advantageous π€ Let me dig into it and see what I find π
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Yay for Vue tidbits! Look forward to more! can you do one on plugins vs mixins ? I never know which to use
Ah mixins is my headache π£ BUT Iβm recently learning the new Vue composition API which solves some of the concern of mixins, so cant wait to be able to use that!
In regards to plugins, can you expand more? So I know content to better create π
Yes of course, so for example in one of my early Vue projects where I had no idea what i was doing. I started writing a mixin which handles all of my HTTP requests to firebase.
I noticed in other projects , this was handled much better as plugin instead, this allowed for you to extend the Vue object, so you could do something like
this.$http.get()
orthis.$http.post()
etc inside a vue component. This seems a lot cleaner! It's left me wondering in which circumstance would a mixin be better choice over a plugin? like you said, perhaps mixins are going out the door with vue 3?Ah gotcha! Thanks for clarifying! That's a good question -- I have been avoiding mixins so I'm not sure when it is advantageous π€ Let me dig into it and see what I find π