Demo:显示和移除滚动条时同时进行滚动条插件的注册和移除
This commit is contained in:
parent
88f2e60720
commit
7b8946bec4
@ -94,7 +94,6 @@ MindMap.usePlugin(MiniMap)
|
|||||||
.usePlugin(TouchEvent)
|
.usePlugin(TouchEvent)
|
||||||
.usePlugin(SearchPlugin)
|
.usePlugin(SearchPlugin)
|
||||||
.usePlugin(Painter)
|
.usePlugin(Painter)
|
||||||
.usePlugin(ScrollbarPlugin)
|
|
||||||
.usePlugin(Formula)
|
.usePlugin(Formula)
|
||||||
// .usePlugin(Cooperate)// 协同插件
|
// .usePlugin(Cooperate)// 协同插件
|
||||||
|
|
||||||
@ -145,6 +144,7 @@ export default {
|
|||||||
...mapState({
|
...mapState({
|
||||||
isZenMode: state => state.localConfig.isZenMode,
|
isZenMode: state => state.localConfig.isZenMode,
|
||||||
openNodeRichText: state => state.localConfig.openNodeRichText,
|
openNodeRichText: state => state.localConfig.openNodeRichText,
|
||||||
|
isShowScrollbar: state => state.localConfig.isShowScrollbar,
|
||||||
useLeftKeySelectionRightKeyDrag: state =>
|
useLeftKeySelectionRightKeyDrag: state =>
|
||||||
state.localConfig.useLeftKeySelectionRightKeyDrag,
|
state.localConfig.useLeftKeySelectionRightKeyDrag,
|
||||||
isShowScrollbar: state => state.localConfig.isShowScrollbar
|
isShowScrollbar: state => state.localConfig.isShowScrollbar
|
||||||
@ -157,6 +157,13 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.removeRichTextPlugin()
|
this.removeRichTextPlugin()
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
isShowScrollbar() {
|
||||||
|
if (this.isShowScrollbar) {
|
||||||
|
this.addScrollbarPlugin()
|
||||||
|
} else {
|
||||||
|
this.removeScrollbarPlugin()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -378,6 +385,7 @@ export default {
|
|||||||
// }
|
// }
|
||||||
})
|
})
|
||||||
if (this.openNodeRichText) this.addRichTextPlugin()
|
if (this.openNodeRichText) this.addRichTextPlugin()
|
||||||
|
if (this.isShowScrollbar) this.addScrollbarPlugin()
|
||||||
this.mindMap.keyCommand.addShortcut('Control+s', () => {
|
this.mindMap.keyCommand.addShortcut('Control+s', () => {
|
||||||
this.manualSave()
|
this.manualSave()
|
||||||
})
|
})
|
||||||
@ -525,6 +533,17 @@ export default {
|
|||||||
this.mindMap.removePlugin(RichText)
|
this.mindMap.removePlugin(RichText)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 加载滚动条插件
|
||||||
|
addScrollbarPlugin() {
|
||||||
|
if (!this.mindMap) return
|
||||||
|
this.mindMap.addPlugin(ScrollbarPlugin)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 移除滚动条插件
|
||||||
|
removeScrollbarPlugin() {
|
||||||
|
this.mindMap.removePlugin(ScrollbarPlugin)
|
||||||
|
},
|
||||||
|
|
||||||
// 测试动态插入节点
|
// 测试动态插入节点
|
||||||
testDynamicCreateNodes() {
|
testDynamicCreateNodes() {
|
||||||
// return
|
// return
|
||||||
|
|||||||
@ -61,6 +61,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
// 向插件传递滚动条宽高数据
|
// 向插件传递滚动条宽高数据
|
||||||
setScrollBarWrapSize() {
|
setScrollBarWrapSize() {
|
||||||
|
if (!this.mindMap.scrollbar) return
|
||||||
const {
|
const {
|
||||||
width
|
width
|
||||||
} = this.$refs.horizontalScrollbarRef.getBoundingClientRect()
|
} = this.$refs.horizontalScrollbarRef.getBoundingClientRect()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user