<template>
    <div>
        <bar-chart></bar-chart>
        <button @click="changeTheme">切换主题</button>
    </div>
</template>

<script>
export default {
    data() {
        return {
            themeType: ''
        }
    },
    methods: {
        changeTheme() {
            this.themeType = this.themeType === 'default' ? 'dark' : 'default'
            document.getElementsByTagName('body')[0].setAttribute('data-theme', this.themeType)
        }
    }
}
</script>
