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

<script>
import ThemePicker from '@/components/ThemePicker'

export default {
    name: 'App',
    components: { ThemePicker },
    metaInfo() {
        return {
            title:
                this.$store.state.settings.dynamicTitle &&
                this.$store.state.settings.title,
            titleTemplate: (title) => {
                return title
                    ? `${title} - ${process.env.VUE_APP_TITLE}`
                    : process.env.VUE_APP_TITLE
            },
        }
    },
    mounted() {
        const script_1 = document.createElement('script')
        const script_2 = document.createElement('script')
        script_1.src = `https://api.map.baidu.com/api?v=2.0&ak=${process.env.VUE_APP_BAIDU_MAP_AK}`
        script_2.src = `https://api.map.baidu.com/api?type=webgl&v=2.0&ak=${process.env.VUE_APP_BAIDU_MAP_AK}`
        script_1.async = true
        document.body.appendChild(script_1)
        document.body.appendChild(script_2)
    },
}
</script>
<style scoped>
#app .theme-picker {
    display: none;
}
</style>
