x-php-Admin/src/App.vue

48 lines
1.1 KiB
Vue
Raw Normal View History

2023-06-07 10:48:30 +00:00
<template>
<el-config-provider :locale="locale" :size="config.size" :zIndex="config.zIndex" :button="config.button">
<router-view></router-view>
</el-config-provider>
</template>
<script>
import colorTool from '@/utils/color'
export default {
name: 'App',
data() {
return {
config: {
size: "default",
zIndex: 2000,
button: {
autoInsertSpace: false
}
}
}
},
computed: {
locale(){
return this.$i18n.messages[this.$i18n.locale].el
},
},
created() {
2023-06-08 11:38:56 +00:00
2023-06-07 10:48:30 +00:00
//设置主题颜色
2023-06-11 14:58:26 +00:00
const app_color = this.$config.COLOR || this.$tool.data.get('APP_COLOR')
2023-06-07 10:48:30 +00:00
if(app_color){
document.documentElement.style.setProperty('--el-color-primary', app_color);
for (let i = 1; i <= 9; i++) {
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(app_color,i/10));
}
for (let i = 1; i <= 9; i++) {
document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, colorTool.darken(app_color,i/10));
}
}
}
}
</script>
<style lang="scss">
@import '@/style/style.scss';
</style>