|
@@ -31,13 +31,24 @@ export default { |
|
@@ -31,13 +31,24 @@ export default { |
|
31
|
immediate: true
|
31
|
immediate: true
|
|
32
|
},
|
32
|
},
|
|
33
|
async theme(val) {
|
33
|
async theme(val) {
|
|
|
|
34
|
+ await this.setTheme(val)
|
|
|
|
35
|
+ }
|
|
|
|
36
|
+ },
|
|
|
|
37
|
+ created() {
|
|
|
|
38
|
+ if(this.defaultTheme !== ORIGINAL_THEME) {
|
|
|
|
39
|
+ this.setTheme(this.defaultTheme)
|
|
|
|
40
|
+ }
|
|
|
|
41
|
+ },
|
|
|
|
42
|
+
|
|
|
|
43
|
+ methods: {
|
|
|
|
44
|
+ async setTheme(val) {
|
|
34
|
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
45
|
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
|
|
35
|
if (typeof val !== 'string') return
|
46
|
if (typeof val !== 'string') return
|
|
36
|
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
47
|
const themeCluster = this.getThemeCluster(val.replace('#', ''))
|
|
37
|
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
48
|
const originalCluster = this.getThemeCluster(oldVal.replace('#', ''))
|
|
38
|
|
49
|
|
|
39
|
const $message = this.$message({
|
50
|
const $message = this.$message({
|
|
40
|
- message: ' Compiling the theme',
|
51
|
+ message: ' 正在切换主题,请稍后...',
|
|
41
|
customClass: 'theme-message',
|
52
|
customClass: 'theme-message',
|
|
42
|
type: 'success',
|
53
|
type: 'success',
|
|
43
|
duration: 0,
|
54
|
duration: 0,
|
|
@@ -82,10 +93,9 @@ export default { |
|
@@ -82,10 +93,9 @@ export default { |
|
82
|
this.$emit('change', val)
|
93
|
this.$emit('change', val)
|
|
83
|
|
94
|
|
|
84
|
$message.close()
|
95
|
$message.close()
|
|
85
|
- }
|
|
|
|
86
|
- },
|
|
|
|
87
|
|
96
|
|
|
88
|
- methods: {
|
97
|
+ },
|
|
|
|
98
|
+
|
|
89
|
updateStyle(style, oldCluster, newCluster) {
|
99
|
updateStyle(style, oldCluster, newCluster) {
|
|
90
|
let newStyle = style
|
100
|
let newStyle = style
|
|
91
|
oldCluster.forEach((color, index) => {
|
101
|
oldCluster.forEach((color, index) => {
|