@@ -104,14 +109,19 @@ export default {
downTypeList() {
return downTypeList[this.$i18n.locale] || downTypeList.zh
- },
+ }
},
created() {
- this.$bus.$on('showExport', () => {
- this.dialogVisible = true
- })
+ this.$bus.$on('showExport', this.handleShowExport)
+ },
+ beforeDestroy() {
+ this.$bus.$off('showExport', this.handleShowExport)
},
methods: {
+ handleShowExport() {
+ this.dialogVisible = true
+ },
+
onPaddingChange() {
this.$bus.$emit('paddingChange', {
exportPaddingX: Number(this.paddingX),
@@ -163,12 +173,7 @@ export default {
this.isTransparent
)
} else {
- this.$bus.$emit(
- 'export',
- this.exportType,
- true,
- this.fileName
- )
+ this.$bus.$emit('export', this.exportType, true, this.fileName)
}
this.$notify.info({
title: this.$t('export.notifyTitle'),
@@ -189,7 +194,7 @@ export default {
.info {
.name {
- color: hsla(0,0%,100%,.9);
+ color: hsla(0, 0%, 100%, 0.9);
}
}
}
@@ -222,7 +227,7 @@ export default {
margin-top: 10px;
&.warning {
- color: #F56C6C;
+ color: #f56c6c;
}
}
@@ -236,7 +241,7 @@ export default {
overflow: hidden;
margin: 10px;
border-radius: 11px;
- box-shadow: 0 0 20px 0 rgba(0,0,0,.02);
+ box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.02);
background-color: #fff;
display: flex;
align-items: center;
diff --git a/web/src/pages/Edit/components/Import.vue b/web/src/pages/Edit/components/Import.vue
index 40cd548d..d2d865e1 100644
--- a/web/src/pages/Edit/components/Import.vue
+++ b/web/src/pages/Edit/components/Import.vue
@@ -58,11 +58,16 @@ export default {
}
},
created() {
- this.$bus.$on('showImport', () => {
- this.dialogVisible = true
- })
+ this.$bus.$on('showImport', this.handleShowImport)
+ },
+ beforeDestroy() {
+ this.$bus.$off('showImport', this.handleShowImport)
},
methods: {
+ handleShowImport() {
+ this.dialogVisible = true
+ },
+
/**
* @Author: 王林
* @Date: 2021-08-03 22:48:42
diff --git a/web/src/pages/Edit/components/NodeHyperlink.vue b/web/src/pages/Edit/components/NodeHyperlink.vue
index 92b0c11b..100ef170 100644
--- a/web/src/pages/Edit/components/NodeHyperlink.vue
+++ b/web/src/pages/Edit/components/NodeHyperlink.vue
@@ -44,7 +44,15 @@ export default {
}
},
created() {
- this.$bus.$on('node_active', (...args) => {
+ this.$bus.$on('node_active', this.handleNodeActive)
+ this.$bus.$on('showNodeLink', this.handleShowNodeLink)
+ },
+ beforeDestroy() {
+ this.$bus.$off('node_active', this.handleNodeActive)
+ this.$bus.$off('showNodeLink', this.handleShowNodeLink)
+ },
+ methods: {
+ handleNodeActive(...args) {
this.activeNodes = args[1]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
@@ -54,14 +62,14 @@ export default {
this.link = ''
this.linkTitle = ''
}
- })
- this.$bus.$on('showNodeLink', () => {
+ },
+
+ handleShowNodeLink() {
this.activeNodes[0].mindMap.keyCommand.pause()
this.$bus.$emit('startTextEdit')
this.dialogVisible = true
- })
- },
- methods: {
+ },
+
/**
* @Author: 王林
* @Date: 2021-06-22 22:08:11
diff --git a/web/src/pages/Edit/components/NodeIcon.vue b/web/src/pages/Edit/components/NodeIcon.vue
index 04f0c79b..6cc5e6db 100644
--- a/web/src/pages/Edit/components/NodeIcon.vue
+++ b/web/src/pages/Edit/components/NodeIcon.vue
@@ -43,7 +43,15 @@ export default {
}
},
created() {
- this.$bus.$on('node_active', (...args) => {
+ this.$bus.$on('node_active', this.handleNodeActive)
+ this.$bus.$on('showNodeIcon', this.handleShowNodeIcon)
+ },
+ beforeDestroy() {
+ this.$bus.$off('node_active', this.handleNodeActive)
+ this.$bus.$off('showNodeIcon', this.handleShowNodeIcon)
+ },
+ methods: {
+ handleNodeActive(...args) {
this.activeNodes = args[1]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
@@ -51,15 +59,15 @@ export default {
} else {
this.iconList = []
}
- })
- this.$bus.$on('showNodeIcon', () => {
+ },
+
+ handleShowNodeIcon() {
this.dialogVisible = true
- })
- },
- methods: {
+ },
+
getHtml(icon) {
return /^
`
- },
+ },
/**
* @Author: 王林
diff --git a/web/src/pages/Edit/components/NodeIconSidebar.vue b/web/src/pages/Edit/components/NodeIconSidebar.vue
index 5293e7f7..01e2fbdb 100644
--- a/web/src/pages/Edit/components/NodeIconSidebar.vue
+++ b/web/src/pages/Edit/components/NodeIconSidebar.vue
@@ -1,40 +1,53 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ item.name }}
-
-
-
![]()
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
+
+
+
{{ item.name }}
+
+
+
![]()
+
+
+
+
+
+
+
-
+
-
+
-
\ No newline at end of file
diff --git a/web/src/pages/Edit/components/NodeImage.vue b/web/src/pages/Edit/components/NodeImage.vue
index 39093020..9e5a597d 100644
--- a/web/src/pages/Edit/components/NodeImage.vue
+++ b/web/src/pages/Edit/components/NodeImage.vue
@@ -6,11 +6,19 @@
width="500"
>
方式一
-
+
方式二
请输入图片地址
-
+
可选
@@ -50,10 +58,19 @@ export default {
}
},
created() {
- this.$bus.$on('node_active', (...args) => {
+ this.$bus.$on('node_active', this.handleNodeActive)
+ this.$bus.$on('showNodeImage', this.handleShowNodeImage)
+ },
+ beforeDestroy() {
+ this.$bus.$off('node_active', this.handleNodeActive)
+ this.$bus.$off('showNodeImage', this.handleShowNodeImage)
+ },
+ methods: {
+ handleNodeActive(...args) {
this.activeNodes = args[1]
- })
- this.$bus.$on('showNodeImage', () => {
+ },
+
+ handleShowNodeImage() {
this.reset()
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
@@ -68,9 +85,8 @@ export default {
this.imgTitle = firstNode.getData('imageTitle')
}
this.dialogVisible = true
- })
- },
- methods: {
+ },
+
cancel() {
this.dialogVisible = false
this.reset()
diff --git a/web/src/pages/Edit/components/NodeNote.vue b/web/src/pages/Edit/components/NodeNote.vue
index 252f222c..0f4786cd 100644
--- a/web/src/pages/Edit/components/NodeNote.vue
+++ b/web/src/pages/Edit/components/NodeNote.vue
@@ -43,7 +43,15 @@ export default {
}
},
created() {
- this.$bus.$on('node_active', (...args) => {
+ this.$bus.$on('node_active', this.handleNodeActive)
+ this.$bus.$on('showNodeNote', this.handleShowNodeNote)
+ },
+ beforeDestroy() {
+ this.$bus.$off('node_active', this.handleNodeActive)
+ this.$bus.$off('showNodeNote', this.handleShowNodeNote)
+ },
+ methods: {
+ handleNodeActive(...args) {
this.activeNodes = args[1]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
@@ -51,16 +59,16 @@ export default {
} else {
this.note = ''
}
- })
- this.$bus.$on('showNodeNote', () => {
+ },
+
+ handleShowNodeNote() {
this.$bus.$emit('startTextEdit')
this.dialogVisible = true
this.$nextTick(() => {
this.initEditor()
})
- })
- },
- methods: {
+ },
+
/**
* @Author: 王林25
* @Date: 2022-05-09 11:37:05
diff --git a/web/src/pages/Edit/components/NodeTag.vue b/web/src/pages/Edit/components/NodeTag.vue
index 711296d7..b12e093b 100644
--- a/web/src/pages/Edit/components/NodeTag.vue
+++ b/web/src/pages/Edit/components/NodeTag.vue
@@ -59,7 +59,15 @@ export default {
}
},
created() {
- this.$bus.$on('node_active', (...args) => {
+ this.$bus.$on('node_active', this.handleNodeActive)
+ this.$bus.$on('showNodeTag', this.handleShowNodeTag)
+ },
+ beforeDestroy() {
+ this.$bus.$off('node_active', this.handleNodeActive)
+ this.$bus.$off('showNodeTag', this.handleShowNodeTag)
+ },
+ methods: {
+ handleNodeActive(...args) {
this.activeNodes = args[1]
if (this.activeNodes.length > 0) {
let firstNode = this.activeNodes[0]
@@ -68,13 +76,13 @@ export default {
this.tagArr = []
this.tag = ''
}
- })
- this.$bus.$on('showNodeTag', () => {
+ },
+
+ handleShowNodeTag() {
this.$bus.$emit('startTextEdit')
this.dialogVisible = true
- })
- },
- methods: {
+ },
+
/**
* @Author: 王林
* @Date: 2021-06-24 21:48:14
diff --git a/web/src/pages/Edit/components/Outline.vue b/web/src/pages/Edit/components/Outline.vue
index 64208bea..44723a1c 100644
--- a/web/src/pages/Edit/components/Outline.vue
+++ b/web/src/pages/Edit/components/Outline.vue
@@ -73,7 +73,19 @@ export default {
},
created() {
window.addEventListener('keydown', this.onKeyDown)
- this.$bus.$on('data_change', () => {
+ this.$bus.$on('data_change', this.handleDataChange)
+ this.$bus.$on('node_tree_render_end', this.handleNodeTreeRenderEnd)
+ },
+ mounted() {
+ this.refresh()
+ },
+ beforeDestroy() {
+ window.removeEventListener('keydown', this.onKeyDown)
+ this.$bus.$off('data_change', this.handleDataChange)
+ this.$bus.$off('node_tree_render_end', this.handleNodeTreeRenderEnd)
+ },
+ methods: {
+ handleDataChange() {
// 在大纲里操作节点时不要响应该事件,否则会重新刷新树
if (this.notHandleDataChange) {
this.notHandleDataChange = false
@@ -84,8 +96,9 @@ export default {
return
}
this.refresh()
- })
- this.$bus.$on('node_tree_render_end', () => {
+ },
+
+ handleNodeTreeRenderEnd() {
// 当前存在未完成的节点插入操作
if (this.insertType) {
this[this.insertType]()
@@ -100,15 +113,8 @@ export default {
this.afterCreateNewNode()
})
}
- })
- },
- mounted() {
- this.refresh()
- },
- beforeDestroy() {
- window.removeEventListener('keydown', this.onKeyDown)
- },
- methods: {
+ },
+
// 刷新树数据
refresh() {
let data = this.mindMap.getData()
@@ -332,7 +338,8 @@ export default {
}
}
- /deep/ .el-tree-node__content:hover, .el-upload-list__item:hover {
+ /deep/ .el-tree-node__content:hover,
+ .el-upload-list__item:hover {
background-color: hsla(0, 0%, 100%, 0.02) !important;
}
diff --git a/web/src/pages/Edit/components/Search.vue b/web/src/pages/Edit/components/Search.vue
index c5dd2391..15fbc512 100644
--- a/web/src/pages/Edit/components/Search.vue
+++ b/web/src/pages/Edit/components/Search.vue
@@ -1,7 +1,7 @@
-
@@ -89,16 +89,23 @@ export default {
},
created() {
this.$bus.$on('show_search', this.showSearch)
- this.mindMap.on('search_info_change', data => {
- this.currentIndex = data.currentIndex + 1
- this.total = data.total
- this.showSearchInfo = true
- })
+ this.mindMap.on('search_info_change', this.handleSearchInfoChange)
this.mindMap.keyCommand.addShortcut('Control+f', this.showSearch)
},
+ beforeDestroy() {
+ this.$bus.$off('show_search', this.showSearch)
+ this.mindMap.off('search_info_change', this.handleSearchInfoChange)
+ this.mindMap.keyCommand.removeShortcut('Control+f', this.showSearch)
+ },
methods: {
isUndef,
+ handleSearchInfoChange(data) {
+ this.currentIndex = data.currentIndex + 1
+ this.total = data.total
+ this.showSearchInfo = true
+ },
+
showSearch() {
this.$bus.$emit('closeSideBar')
this.show = true
diff --git a/web/src/pages/Edit/components/Sidebar.vue b/web/src/pages/Edit/components/Sidebar.vue
index 377a93c0..33ced970 100644
--- a/web/src/pages/Edit/components/Sidebar.vue
+++ b/web/src/pages/Edit/components/Sidebar.vue
@@ -49,13 +49,18 @@ export default {
}
},
created() {
- this.$bus.$on('closeSideBar', () => {
- this.close()
- })
+ this.$bus.$on('closeSideBar', this.handleCloseSidebar)
+ },
+ beforeDestroy() {
+ this.$bus.$off('closeSideBar', this.handleCloseSidebar)
},
methods: {
...mapMutations(['setActiveSidebar']),
+ handleCloseSidebar() {
+ this.close()
+ },
+
close() {
this.show = false
this.setActiveSidebar('')
diff --git a/web/src/pages/Edit/components/Theme.vue b/web/src/pages/Edit/components/Theme.vue
index 38c1965a..9b6c6c8b 100644
--- a/web/src/pages/Edit/components/Theme.vue
+++ b/web/src/pages/Edit/components/Theme.vue
@@ -81,15 +81,19 @@ export default {
this.initGroup()
this.theme = this.mindMap.getTheme()
this.handleDark()
-
- this.mindMap.on('view_theme_change', () => {
- this.theme = this.mindMap.getTheme()
- this.handleDark()
- })
+ this.mindMap.on('view_theme_change', this.handleViewThemeChange)
+ },
+ beforeDestroy() {
+ this.mindMap.off('view_theme_change', this.handleViewThemeChange)
},
methods: {
...mapMutations(['setIsDark']),
+ handleViewThemeChange() {
+ this.theme = this.mindMap.getTheme()
+ this.handleDark()
+ },
+
initGroup() {
let baiduThemes = [
'default',
diff --git a/web/src/pages/Edit/components/Toolbar.vue b/web/src/pages/Edit/components/Toolbar.vue
index 4f8b7d56..26ff1e71 100644
--- a/web/src/pages/Edit/components/Toolbar.vue
+++ b/web/src/pages/Edit/components/Toolbar.vue
@@ -247,7 +247,7 @@ export default {
this.$bus.$off('node_active', this.onNodeActive)
this.$bus.$off('back_forward', this.onBackForward)
this.$bus.$off('write_local_file', this.onWriteLocalFile)
- this.$bus.$on('painter_start', this.onPainterStart)
+ this.$bus.$off('painter_start', this.onPainterStart)
this.$bus.$off('painter_end', this.onPainterEnd)
},
methods: {