Files
aurora-admin/frameworks/ThemeSwitcher.vue2.vue
T

46 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="aa-themesw">
<div
v-for="m in modes"
:key="m.value"
class="aa-themesw-opt"
:class="{ 'is-active': mode === m.value }"
@click="$emit('update:mode', m.value)"
>
<span class="aa-themesw-dot" :class="m.value"></span>{{ m.label }}
</div>
<div class="aa-themesw-colors">
<span
v-for="c in brands"
:key="c"
class="aa-themesw-color"
:class="{ 'is-active': brand === c }"
:style="{ background: c }"
@click="$emit('update:brand', c)"
></span>
</div>
<div class="aa-themesw-label">品牌色:{{ brand }}(应用于 CSS 变量 --brand 实时预览)</div>
</div>
</template>
<script>
export default {
name: 'AaThemeSwitcher',
props: {
mode: { type: String, default: 'light' },
brand: { type: String, default: '#2F54EB' }
},
data() {
return {
modes: [
{ value: 'light', label: '浅色' },
{ value: 'dark', label: '深色' }
],
brands: ['#2F54EB', '#1677FF', '#722ED1', '#13C2C2', '#FA541C', '#EB2F96']
};
}
};
</script>
<style src="./ThemeSwitcher.css"></style>