<template>
    <div class="app" id="app">
        <router-view></router-view>
    </div>
</template>

<script>
export default {
    name: 'App',
    data() {
        return {
            themeType: 'dark'
        }
    },
    mounted() {
        this.changeTheme()
    },
    methods: {
        changeTheme() {
            var url = window.location.href
            var theRequest = new Object()
            if (url.indexOf('?') != -1) {
                var str = url.split('?')[1]
                var strs = str.split('&')
                for (var i = 0; i < strs.length; i++) {
                    theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
                }
            }
            this.themeType = theRequest.theme.split('#')[0] ? theRequest.theme.split('#')[0] : 'light'
            document.getElementsByTagName('body')[0].setAttribute('data-theme', this.themeType)
        }
    }
}
</script>
<style lang="scss">
@import './assets/styles/common.scss';
</style>
