Currently, I am working with Nuxtjs version 2.15.7 and have a mixin file structured like this:
utils.js :
import Vue from "vue"
if (!Vue.__utils__) {
Vue.__utils__ = true
Vue.mixin({
data(){
return{
...
}
},
methods:{
...
}
})
}
Now, I am looking to create another global mixin that builds upon my existing utils.js file. Here is an example of what I want to achieve:
utils-another.js :
import utils from '@/plugins/mixins/utils.js'
import Vue from "vue"
if (!Vue.__utils__) {
Vue.__utils__ = true
Vue.mixin({
// ... codes from utils.js
data(){
return{
...
}
},
methods:{
...
}
})
}
I need to be able to choose between using utils.js
or utils-another.js
based on a specific environment property. How should I go about implementing this without duplicating all the code from utils.js into utils-another.js for easier maintenance?