In my Vue application, I want to change the theme dynamically. ie, I had created 3 different themes for different types of users and also I had created an API call to identify the logged-in user type. Based on this result of the API call, I want to change the theme of the Vue application. The theme files in SCSS and I have attached my App.vue file below.
<template>
<div id="app">
<component :is="layout">
</component>
</div>
</template>
<script>
import Pages from "./mixins/PagesScripts";
const defaultLayout = "default-layout";
export default {
name: 'App',
computed: {
layout() {
// TODO: Implement more layout and layout rendering mechanisms here
return defaultLayout;
}
},
mixins: [Pages],
mounted(){
// Here I will call the API using Axios and based on the API result, I want to change the
// below SCSS file to pages1,pages2 etc..
}
};
</script>
<style lang="scss">
@import "assets/scss/pages";
</style>
I am using Vue-CLI version 4.4.6.