mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 14:04:47 +08:00
Demo:工具栏中的公式按钮根据是否开启节点富文本配置进行显示和隐藏
This commit is contained in:
@@ -215,7 +215,8 @@ export default {
|
||||
computed: {
|
||||
...mapState({
|
||||
isDark: state => state.localConfig.isDark,
|
||||
isHandleLocalFile: state => state.isHandleLocalFile
|
||||
isHandleLocalFile: state => state.isHandleLocalFile,
|
||||
openNodeRichText: state => state.localConfig.openNodeRichText
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
@@ -223,6 +224,24 @@ export default {
|
||||
if (!val) {
|
||||
Notification.closeAll()
|
||||
}
|
||||
},
|
||||
openNodeRichText: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
const index = this.list.findIndex(item => {
|
||||
return item === 'formula'
|
||||
})
|
||||
if (val) {
|
||||
if (index === -1) {
|
||||
this.list.splice(13, 0, 'formula')
|
||||
}
|
||||
} else {
|
||||
if (index !== -1) {
|
||||
this.list.splice(index, 1)
|
||||
}
|
||||
}
|
||||
this.computeToolbarShow()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -246,6 +265,7 @@ export default {
|
||||
methods: {
|
||||
// 计算工具按钮如何显示
|
||||
computeToolbarShow() {
|
||||
if (!this.$refs.toolbarRef) return
|
||||
const windowWidth = window.innerWidth - 40
|
||||
const all = [...this.list]
|
||||
let index = 1
|
||||
|
||||
Reference in New Issue
Block a user