i've been working on mixins but i can't have any clue with this.
what i want is conditionally import js file but NOT using component.
this is the FIRST way what i've been doing so far.
export default {
mixins:[],
mounted(){
if( condition1){
require('../folder/file1.js');
}else if(condition2){
require('../folder/file2.js');
}else if(condition3){
require('../folder/file3.js');
}
}
}
but the problem is that i don't know how to make these js files as mixins ! is there any way to make this as a mixins?
this is the SECOND way
normally mixins are declared like this, so i imported upper than this. like below
if(condition1) {
import file1 from '../folder/file1.js'
}else if(condition2){
import file2 from '../folder/file2.js'
}
export default {
mixins: [file1, file2]
}
but it keeps make error so it just keeps making blank page. (error msg is like something undefined with conditions..!) so will it be solved if i made condition right? or do i missing something?
your help will be very very appriciated :-) thanks!