Files
dashy/src/views/Workspace.vue
2021-06-17 13:34:02 +01:00

55 lines
1.3 KiB
Vue

<template>
<div class="work-space">
<SideBar :sections="sections" @launch="launchService" />
<WebContent :url="url" />
</div>
</template>
<script>
import SideBar from '@/components/Workspace/SideBar';
import WebContent from '@/components/Workspace/WebContent';
import Defaults, { localStorageKeys } from '@/utils/defaults';
export default {
name: 'Workspace',
props: {
sections: Array,
appConfig: Object,
},
data: () => ({
url: '',
}),
components: {
SideBar,
WebContent,
},
methods: {
launchService(url) {
this.url = url;
},
setTheme() {
const theme = localStorage[localStorageKeys.THEME] || this.confTheme || Defaults.theme;
const htmlTag = document.getElementsByTagName('html')[0];
if (htmlTag.hasAttribute('data-theme')) htmlTag.removeAttribute('data-theme');
htmlTag.setAttribute('data-theme', theme);
},
initiateFontAwesome() {
const fontAwesomeScript = document.createElement('script');
const faKey = this.appConfig.fontAwesomeKey || Defaults.fontAwesomeKey;
fontAwesomeScript.setAttribute('src', `https://kit.fontawesome.com/${faKey}.js`);
document.head.appendChild(fontAwesomeScript);
},
},
mounted() {
this.setTheme();
this.initiateFontAwesome();
},
};
</script>
<style scoped lang="scss">
</style>