+
+
+
{
+ return item.name === this.activeName
+ }).list
+ }
},
watch: {
activeSidebar(val) {
@@ -62,12 +73,43 @@ export default {
}
},
created() {
+ this.initGroup()
this.theme = this.mindMap.getTheme()
this.handleDark()
},
methods: {
...mapMutations(['setIsDark']),
+ initGroup() {
+ let baiduThemes = ['default', 'skyGreen', 'classic2', 'classic3', 'classicGreen', 'classicBlue', 'blueSky', 'brainImpairedPink', 'earthYellow', 'freshGreen', 'freshRed', 'romanticPurple', 'pinkGrape', 'mint']
+ let baiduList = []
+ let classicsList = []
+ this.themeList.forEach((item) => {
+ if (baiduThemes.includes(item.value)) {
+ baiduList.push(item)
+ } else if (!item.dark) {
+ classicsList.push(item)
+ }
+ })
+ this.groupList = [
+ {
+ name: '经典',
+ list: classicsList
+ },
+ {
+ name: '深色',
+ list: this.themeList.filter((item) => {
+ return item.dark
+ })
+ },
+ {
+ name: '朴素',
+ list: baiduList
+ }
+ ]
+ this.activeName = this.groupList[0].name
+ },
+
useTheme(theme) {
this.theme = theme.value
this.handleDark()
@@ -102,7 +144,7 @@ export default {
},
handleDark() {
- let target = themeList.find(item => {
+ let target = this.themeList.find(item => {
return item.value === this.theme
})
this.setIsDark(target.dark)
@@ -114,6 +156,7 @@ export default {