Demo:优化代码,去除无用的注释、去除组件name、引入vue组件添加后缀

This commit is contained in:
街角小林 2025-03-03 16:58:50 +08:00
parent 2a8959fb3b
commit c7cd19f956
46 changed files with 97 additions and 420 deletions

View File

@ -17,11 +17,7 @@ const createFullData = () => {
}; };
} }
/** // 节点较多示例数据
* @Author: 王林
* @Date: 2021-04-15 22:23:24
* @Desc: 节点较多示例数据
*/
const data1 = { const data1 = {
"root": { "root": {
"data": { "data": {

View File

@ -6,8 +6,7 @@
<script> <script>
export default { export default {
name: 'App', name: 'App'
components: {}
} }
</script> </script>

View File

@ -9,11 +9,7 @@ const SIMPLE_MIND_MAP_LOCAL_CONFIG = 'SIMPLE_MIND_MAP_LOCAL_CONFIG'
let mindMapData = null let mindMapData = null
/** // 获取缓存的思维导图数据
* @Author: 王林
* @Date: 2021-08-01 10:10:49
* @Desc: 获取缓存的思维导图数据
*/
export const getData = () => { export const getData = () => {
if (window.takeOverApp) { if (window.takeOverApp) {
mindMapData = window.takeOverAppMethods.getMindMapData() mindMapData = window.takeOverAppMethods.getMindMapData()
@ -34,11 +30,7 @@ export const getData = () => {
} }
} }
/** // 存储思维导图数据
* @Author: 王林
* @Date: 2021-08-01 10:14:28
* @Desc: 存储思维导图数据
*/
export const storeData = data => { export const storeData = data => {
try { try {
let originData = null let originData = null
@ -64,11 +56,7 @@ export const storeData = data => {
} }
} }
/** // 存储思维导图配置数据
* @Author: 王林
* @Date: 2021-08-01 10:24:56
* @Desc: 存储思维导图配置数据
*/
export const storeConfig = config => { export const storeConfig = config => {
try { try {
let originData = null let originData = null
@ -97,12 +85,7 @@ export const storeConfig = config => {
} }
} }
/** // 存储语言
* javascript comment
* @Author: 王林
* @Date: 2022-11-05 14:36:50
* @Desc: 存储语言
*/
export const storeLang = lang => { export const storeLang = lang => {
if (window.takeOverApp) { if (window.takeOverApp) {
window.takeOverAppMethods.saveLanguage(lang) window.takeOverAppMethods.saveLanguage(lang)
@ -111,12 +94,7 @@ export const storeLang = lang => {
localStorage.setItem(SIMPLE_MIND_MAP_LANG, lang) localStorage.setItem(SIMPLE_MIND_MAP_LANG, lang)
} }
/** // 获取存储的语言
* javascript comment
* @Author: 王林
* @Date: 2022-11-05 14:37:36
* @Desc: 获取存储的语言
*/
export const getLang = () => { export const getLang = () => {
if (window.takeOverApp) { if (window.takeOverApp) {
return window.takeOverAppMethods.getLanguage() || 'zh' return window.takeOverAppMethods.getLanguage() || 'zh'

View File

@ -30,7 +30,6 @@
<script> <script>
export default { export default {
name: 'ImgUpload',
model: { model: {
prop: 'value', prop: 'value',
event: 'change' event: 'change'
@ -47,32 +46,20 @@ export default {
} }
}, },
methods: { methods: {
/** //
* @Author: 王林
* @Date: 2019-12-22 19:47:19
* @Desc: 图片选择事件
*/
onImgUploadInputChange(e) { onImgUploadInputChange(e) {
let file = e.target.files[0] let file = e.target.files[0]
this.selectImg(file) this.selectImg(file)
}, },
/** //
* @Author: 王林
* @Date: 2019-12-22 20:32:31
* @Desc: 拖动上传图片
*/
onDrop(e) { onDrop(e) {
let dt = e.dataTransfer let dt = e.dataTransfer
let file = dt.files && dt.files[0] let file = dt.files && dt.files[0]
this.selectImg(file) this.selectImg(file)
}, },
/** //
* @Author: 王林
* @Date: 2021-06-06 16:56:14
* @Desc: 选择图片
*/
selectImg(file) { selectImg(file) {
this.file = file this.file = file
let fr = new FileReader() let fr = new FileReader()
@ -82,11 +69,7 @@ export default {
} }
}, },
/** //
* @Author: 王林
* @Date: 2021-06-22 23:03:46
* @Desc: 获取图片大小
*/
getSize() { getSize() {
return new Promise(resolve => { return new Promise(resolve => {
let img = new Image() let img = new Image()
@ -106,11 +89,7 @@ export default {
}) })
}, },
/** //
* @Author: 王林
* @Date: 2021-06-06 21:59:57
* @Desc: 删除图片
*/
deleteImg() { deleteImg() {
this.$emit('change', '') this.$emit('change', '')
this.file = null this.file = null

View File

@ -11,13 +11,12 @@
</template> </template>
<script> <script>
import Toolbar from './components/Toolbar' import Toolbar from './components/Toolbar.vue'
import Edit from './components/Edit' import Edit from './components/Edit.vue'
import { mapState, mapActions, mapMutations } from 'vuex' import { mapState, mapActions, mapMutations } from 'vuex'
import { getLocalConfig } from '@/api' import { getLocalConfig } from '@/api'
export default { export default {
name: 'Index',
components: { components: {
Toolbar, Toolbar,
Edit Edit
@ -54,11 +53,7 @@ export default {
...mapActions(['getUserMindMapData']), ...mapActions(['getUserMindMapData']),
...mapMutations(['setLocalConfig']), ...mapMutations(['setLocalConfig']),
/** //
* @Author: 王林25
* @Date: 2022-11-14 19:07:03
* @Desc: 初始化本地配置
*/
initLocalConfig() { initLocalConfig() {
let config = getLocalConfig() let config = getLocalConfig()
if (config) { if (config) {

View File

@ -58,7 +58,7 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { createUid } from 'simple-mind-map/src/utils' import { createUid } from 'simple-mind-map/src/utils'
import MarkdownIt from 'markdown-it' import MarkdownIt from 'markdown-it'

View File

@ -209,28 +209,15 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import Color from './Color' import Color from './Color.vue'
import { import {
lineWidthList, lineWidthList,
lineStyleList,
backgroundRepeatList,
backgroundPositionList,
backgroundSizeList,
fontFamilyList, fontFamilyList,
fontSizeList, fontSizeList,
rootLineKeepSameInCurveList,
lineStyleMap,
borderDasharrayList borderDasharrayList
} from '@/config' } from '@/config'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import {
supportLineStyleLayoutsMap,
supportLineRadiusLayouts,
supportNodeUseLineStyleLayouts,
supportRootLineKeepSameInCurveLayouts,
rainbowLinesOptions
} from '@/config/constant'
const defaultStyle = { const defaultStyle = {
associativeLineColor: '', associativeLineColor: '',
@ -244,7 +231,6 @@ const defaultStyle = {
} }
export default { export default {
name: 'BaseStyle',
components: { components: {
Sidebar, Sidebar,
Color Color

View File

@ -804,8 +804,8 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import Color from './Color' import Color from './Color.vue'
import { import {
lineWidthList, lineWidthList,
lineStyleList, lineStyleList,
@ -818,9 +818,9 @@ import {
lineStyleMap, lineStyleMap,
borderDasharrayList borderDasharrayList
} from '@/config' } from '@/config'
import ImgUpload from '@/components/ImgUpload' import ImgUpload from '@/components/ImgUpload/index.vue'
import { storeConfig } from '@/api' import { storeConfig } from '@/api'
import { mapState, mapMutations } from 'vuex' import { mapState } from 'vuex'
import { import {
supportLineStyleLayoutsMap, supportLineStyleLayoutsMap,
supportLineRadiusLayouts, supportLineRadiusLayouts,
@ -829,13 +829,8 @@ import {
rainbowLinesOptions rainbowLinesOptions
} from '@/config/constant' } from '@/config/constant'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:52:56
* @Desc: 基础样式
*/
export default { export default {
name: 'BaseStyle',
components: { components: {
Sidebar, Sidebar,
Color, Color,

View File

@ -26,13 +26,8 @@
import { colorList } from '@/config' import { colorList } from '@/config'
import { mapState } from 'vuex' import { mapState } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 颜色选择器
*/
export default { export default {
name: 'Color',
props: { props: {
color: { color: {
type: String, type: String,
@ -59,20 +54,12 @@ export default {
this.selectColor = this.color this.selectColor = this.color
}, },
methods: { methods: {
/** //
* @Author: 王林
* @Date: 2021-05-05 09:38:06
* @Desc: 点击预设颜色
*/
clickColorItem(color) { clickColorItem(color) {
this.$emit('change', color) this.$emit('change', color)
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 10:17:26
* @Desc: 修改颜色
*/
changeColor() { changeColor() {
this.$emit('change', this.selectColor) this.$emit('change', this.selectColor)
} }

View File

@ -224,13 +224,8 @@ import { transformToTxt } from 'simple-mind-map/src/parse/toTxt'
import { setDataToClipboard, setImgToClipboard, copy } from '@/utils' import { setDataToClipboard, setImgToClipboard, copy } from '@/utils'
import { numberTypeList, numberLevelList } from '@/config' import { numberTypeList, numberLevelList } from '@/config'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 右键菜单
*/
export default { export default {
name: 'Contextmenu',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -14,15 +14,9 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 字数及节点数量统计
*/
let countEl = document.createElement('div') let countEl = document.createElement('div')
export default { export default {
name: 'Count',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object
@ -50,11 +44,7 @@ export default {
this.$bus.$off('data_change', this.onDataChange) this.$bus.$off('data_change', this.onDataChange)
}, },
methods: { methods: {
/** //
* @Author: 王林25
* @Date: 2022-11-14 19:20:20
* @Desc: 监听数据变化
*/
onDataChange(data) { onDataChange(data) {
this.textStr = '' this.textStr = ''
this.words = 0 this.words = 0
@ -64,11 +54,7 @@ export default {
this.words = countEl.textContent.length this.words = countEl.textContent.length
}, },
/** //
* @Author: 王林
* @Date: 2021-06-30 22:13:07
* @Desc: 遍历
*/
walk(data) { walk(data) {
if (!data) return if (!data) return
this.num++ this.num++

View File

@ -96,16 +96,16 @@ import Checkbox from 'simple-mind-map-plugin-checkbox'
import LineFlow from 'simple-mind-map-plugin-lineflow' import LineFlow from 'simple-mind-map-plugin-lineflow'
import Momentum from 'simple-mind-map-plugin-momentum' import Momentum from 'simple-mind-map-plugin-momentum'
// npm link simple-mind-map-plugin-excel simple-mind-map-plugin-freemind simple-mind-map-plugin-numbers simple-mind-map-plugin-notation simple-mind-map-plugin-handdrawnlikestyle simple-mind-map-plugin-checkbox simple-mind-map simple-mind-map-plugin-themes simple-mind-map-plugin-lineflow simple-mind-map-plugin-momentum // npm link simple-mind-map-plugin-excel simple-mind-map-plugin-freemind simple-mind-map-plugin-numbers simple-mind-map-plugin-notation simple-mind-map-plugin-handdrawnlikestyle simple-mind-map-plugin-checkbox simple-mind-map simple-mind-map-plugin-themes simple-mind-map-plugin-lineflow simple-mind-map-plugin-momentum
import OutlineSidebar from './OutlineSidebar' import OutlineSidebar from './OutlineSidebar.vue'
import Style from './Style' import Style from './Style.vue'
import BaseStyle from './BaseStyle' import BaseStyle from './BaseStyle.vue'
import Theme from './Theme' import Theme from './Theme.vue'
import Structure from './Structure' import Structure from './Structure.vue'
import Count from './Count' import Count from './Count.vue'
import NavigatorToolbar from './NavigatorToolbar' import NavigatorToolbar from './NavigatorToolbar.vue'
import ShortcutKey from './ShortcutKey' import ShortcutKey from './ShortcutKey.vue'
import Contextmenu from './Contextmenu' import Contextmenu from './Contextmenu.vue'
import RichTextToolbar from './RichTextToolbar' import RichTextToolbar from './RichTextToolbar.vue'
import NodeNoteContentShow from './NodeNoteContentShow.vue' import NodeNoteContentShow from './NodeNoteContentShow.vue'
import { getData, storeData, storeConfig } from '@/api' import { getData, storeData, storeConfig } from '@/api'
import Navigator from './Navigator.vue' import Navigator from './Navigator.vue'
@ -163,7 +163,6 @@ MindMap.usePlugin(MiniMap)
Themes.init(MindMap) Themes.init(MindMap)
export default { export default {
name: 'Edit',
components: { components: {
OutlineSidebar, OutlineSidebar,
Style, Style,

View File

@ -121,14 +121,9 @@ import { downTypeList } from '@/config'
import { isMobile } from 'simple-mind-map/src/utils/index' import { isMobile } from 'simple-mind-map/src/utils/index'
import MarkdownIt from 'markdown-it' import MarkdownIt from 'markdown-it'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:54
* @Desc: 导出
*/
let md = null let md = null
export default { export default {
name: 'Export',
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
@ -193,20 +188,10 @@ export default {
}) })
}, },
/**
* @Author: 王林
* @Date: 2021-06-22 22:08:11
* @Desc: 取消
*/
cancel() { cancel() {
this.dialogVisible = false this.dialogVisible = false
}, },
/**
* @Author: 王林
* @Date: 2021-06-06 22:28:20
* @Desc: 确定
*/
confirm() { confirm() {
this.setExtraTextOnExport(this.extraText) this.setExtraTextOnExport(this.extraText)
if (this.exportType === 'svg') { if (this.exportType === 'svg') {

View File

@ -31,12 +31,11 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import { formulaList } from '@/config/constant' import { formulaList } from '@/config/constant'
export default { export default {
name: 'FormulaSidebar',
components: { components: {
Sidebar Sidebar
}, },

View File

@ -22,13 +22,8 @@
<script> <script>
import { fullscrrenEvent, fullScreen } from '@/utils' import { fullscrrenEvent, fullScreen } from '@/utils'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 全屏
*/
export default { export default {
name: 'Fullscreen',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -62,13 +62,8 @@ import markdown from 'simple-mind-map/src/parse/markdown.js'
import { mapMutations, mapState } from 'vuex' import { mapMutations, mapState } from 'vuex'
import Vue from 'vue' import Vue from 'vue'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:54
* @Desc: 导入
*/
export default { export default {
name: 'Import',
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,

View File

@ -22,13 +22,8 @@
<script> <script>
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 鼠标操作设置
*/
export default { export default {
name: 'MouseAction',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -109,8 +109,8 @@
</template> </template>
<script> <script>
import Scale from './Scale' import Scale from './Scale.vue'
import Fullscreen from './Fullscreen' import Fullscreen from './Fullscreen.vue'
import MouseAction from './MouseAction.vue' import MouseAction from './MouseAction.vue'
import { langList } from '@/config' import { langList } from '@/config'
import i18n from '@/i18n' import i18n from '@/i18n'
@ -119,13 +119,8 @@ import { mapState, mapMutations } from 'vuex'
import pkg from 'simple-mind-map/package.json' import pkg from 'simple-mind-map/package.json'
import Demonstrate from './Demonstrate.vue' import Demonstrate from './Demonstrate.vue'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 导航器工具栏
*/
export default { export default {
name: 'NavigatorToolbar',
components: { components: {
Scale, Scale,
Fullscreen, Fullscreen,

View File

@ -108,7 +108,7 @@
<script> <script>
import { lineWidthList } from '@/config' import { lineWidthList } from '@/config'
import Color from './Color' import Color from './Color.vue'
const defaultConfig = { const defaultConfig = {
type: 'circle', type: 'circle',

View File

@ -44,13 +44,8 @@
<script> <script>
import { isMobile } from 'simple-mind-map/src/utils/index' import { isMobile } from 'simple-mind-map/src/utils/index'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:17
* @Desc: 节点超链接内容设置
*/
export default { export default {
name: 'NodeHyperlink',
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
@ -103,20 +98,10 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
/**
* @Author: 王林
* @Date: 2021-06-22 22:08:11
* @Desc: 取消
*/
cancel() { cancel() {
this.dialogVisible = false this.dialogVisible = false
}, },
/**
* @Author: 王林
* @Date: 2021-06-06 22:28:20
* @Desc: 确定
*/
confirm() { confirm() {
this.activeNodes.forEach(node => { this.activeNodes.forEach(node => {
node.setHyperlink( node.setHyperlink(

View File

@ -27,13 +27,8 @@
import { nodeIconList } from 'simple-mind-map/src/svg/icons' import { nodeIconList } from 'simple-mind-map/src/svg/icons'
import icon from '@/config/icon' import icon from '@/config/icon'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:33
* @Desc: 节点图标内容设置
*/
export default { export default {
name: 'NodeIcon',
data() { data() {
return { return {
nodeIconList: [...nodeIconList, ...icon], nodeIconList: [...nodeIconList, ...icon],
@ -69,11 +64,6 @@ export default {
return /^<svg/.test(icon) ? icon : `<img src="${icon}" />` return /^<svg/.test(icon) ? icon : `<img src="${icon}" />`
}, },
/**
* @Author: 王林
* @Date: 2021-06-23 23:16:56
* @Desc: 设置icon
*/
setIcon(type, name) { setIcon(type, name) {
let key = type + '_' + name let key = type + '_' + name
let index = this.iconList.findIndex(item => { let index = this.iconList.findIndex(item => {

View File

@ -55,7 +55,7 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { nodeIconList } from 'simple-mind-map/src/svg/icons' import { nodeIconList } from 'simple-mind-map/src/svg/icons'
import { mergerIconList } from 'simple-mind-map/src/utils/index' import { mergerIconList } from 'simple-mind-map/src/utils/index'
@ -63,7 +63,6 @@ import icon from '@/config/icon'
import image from '@/config/image' import image from '@/config/image'
export default { export default {
name: 'NodeIconSidebar',
components: { components: {
Sidebar Sidebar
}, },

View File

@ -19,10 +19,6 @@ import { mapState, mapMutations } from 'vuex'
const allIconList = [..._nodeIconList, ...icon] const allIconList = [..._nodeIconList, ...icon]
export default { export default {
name: 'NodeIconToolbar',
components: {
},
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -37,16 +37,11 @@
</template> </template>
<script> <script>
import ImgUpload from '@/components/ImgUpload' import ImgUpload from '@/components/ImgUpload/index.vue'
import { getImageSize, isMobile } from 'simple-mind-map/src/utils/index' import { getImageSize, isMobile } from 'simple-mind-map/src/utils/index'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:45
* @Desc: 节点图片内容设置
*/
export default { export default {
name: 'NodeImage',
components: { components: {
ImgUpload ImgUpload
}, },

View File

@ -22,11 +22,7 @@
</template> </template>
<script> <script>
import { mapState, mapMutations } from 'vuex'
export default { export default {
name: 'NodeImgPlacementToolbar',
components: {},
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -29,11 +29,7 @@ import Editor from '@toast-ui/editor'
import '@toast-ui/editor/dist/toastui-editor.css' // Editor's Style import '@toast-ui/editor/dist/toastui-editor.css' // Editor's Style
import { isMobile } from 'simple-mind-map/src/utils/index' import { isMobile } from 'simple-mind-map/src/utils/index'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:54
* @Desc: 节点备注内容设置
*/
export default { export default {
name: 'NodeNote', name: 'NodeNote',
data() { data() {

View File

@ -18,13 +18,8 @@
import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer' import Viewer from '@toast-ui/editor/dist/toastui-editor-viewer'
import '@toast-ui/editor/dist/toastui-editor-viewer.css' import '@toast-ui/editor/dist/toastui-editor-viewer.css'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:54
* @Desc: 节点备注内容显示
*/
export default { export default {
name: 'NodeNoteContentShow',
props: { props: {
mindMap: { mindMap: {
type: Object, type: Object,

View File

@ -132,7 +132,7 @@
</template> </template>
<script> <script>
import Color from './Color' import Color from './Color.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { lineWidthList, borderDasharrayList } from '@/config' import { lineWidthList, borderDasharrayList } from '@/config'

View File

@ -45,13 +45,8 @@ import {
isMobile isMobile
} from 'simple-mind-map/src/utils/index' } from 'simple-mind-map/src/utils/index'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:03
* @Desc: 节点标签内容设置
*/
export default { export default {
name: 'NodeTag',
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
@ -96,11 +91,6 @@ export default {
this.dialogVisible = true this.dialogVisible = true
}, },
/**
* @Author: 王林
* @Date: 2021-06-24 21:48:14
* @Desc: 添加
*/
add() { add() {
const text = this.tag.trim() const text = this.tag.trim()
if (!text) return if (!text) return
@ -108,29 +98,14 @@ export default {
this.tag = '' this.tag = ''
}, },
/**
* @Author: 王林
* @Date: 2021-06-24 21:57:53
* @Desc: 删除
*/
del(index) { del(index) {
this.tagArr.splice(index, 1) this.tagArr.splice(index, 1)
}, },
/**
* @Author: 王林
* @Date: 2021-06-22 22:08:11
* @Desc: 取消
*/
cancel() { cancel() {
this.dialogVisible = false this.dialogVisible = false
}, },
/**
* @Author: 王林
* @Date: 2021-06-06 22:28:20
* @Desc: 确定
*/
confirm() { confirm() {
this.activeNodes.forEach(node => { this.activeNodes.forEach(node => {
node.setTag(this.tagArr) node.setTag(this.tagArr)

View File

@ -27,7 +27,7 @@
</template> </template>
<script> <script>
import Color from './Color' import Color from './Color.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {

View File

@ -50,7 +50,6 @@ import {
// //
export default { export default {
name: 'Outline',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -78,7 +78,6 @@ import { printOutline } from '@/utils'
// //
export default { export default {
name: 'OutlineEdit',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -36,14 +36,13 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import Outline from './Outline.vue' import Outline from './Outline.vue'
import { printOutline } from '@/utils' import { printOutline } from '@/utils'
// //
export default { export default {
name: 'OutlineSidebar',
components: { components: {
Sidebar, Sidebar,
Outline Outline

View File

@ -139,11 +139,10 @@
<script> <script>
import { fontFamilyList, fontSizeList, alignList } from '@/config' import { fontFamilyList, fontSizeList, alignList } from '@/config'
import Color from './Color' import Color from './Color.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
name: 'RichTextToolbar',
components: { components: {
Color Color
}, },

View File

@ -32,13 +32,8 @@
</template> </template>
<script> <script>
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:10
* @Desc: 放大缩小
*/
export default { export default {
name: 'Scale',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -78,7 +78,6 @@ import { isUndef, getTextFromHtml } from 'simple-mind-map/src/utils/index'
// //
export default { export default {
name: 'Search',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -392,10 +392,10 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { storeConfig } from '@/api' import { storeConfig } from '@/api'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import Color from './Color' import Color from './Color.vue'
export default { export default {
components: { components: {

View File

@ -20,17 +20,12 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { shortcutKeyList } from '@/config' import { shortcutKeyList } from '@/config'
import { mapState } from 'vuex' import { mapState } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:14
* @Desc: 快捷键
*/
export default { export default {
name: 'ShortcutKey',
components: { components: {
Sidebar Sidebar
}, },

View File

@ -19,13 +19,8 @@
import { store } from '@/config' import { store } from '@/config'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:25
* @Desc: 侧边栏容器
*/
export default { export default {
name: 'Sidebar',
props: { props: {
title: { title: {
type: String, type: String,

View File

@ -27,13 +27,8 @@
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import { sidebarTriggerList } from '@/config' import { sidebarTriggerList } from '@/config'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:25
* @Desc: 侧边栏触发器
*/
export default { export default {
name: 'SidebarTrigger',
data() { data() {
return { return {
show: true, show: true,

View File

@ -58,7 +58,6 @@
<script> <script>
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import { storeData } from '@/api'
import CodeMirror from 'codemirror' import CodeMirror from 'codemirror'
import 'codemirror/mode/javascript/javascript' import 'codemirror/mode/javascript/javascript'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
@ -68,7 +67,6 @@ let editor = null
// //
export default { export default {
name: 'SourceCodeEdit',
props: { props: {
mindMap: { mindMap: {
type: Object type: Object

View File

@ -18,19 +18,14 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { layoutList } from 'simple-mind-map/src/constants/constant' import { layoutList } from 'simple-mind-map/src/constants/constant'
import { storeConfig } from '@/api' import { storeConfig } from '@/api'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { layoutImgMap } from '@/config/constant.js' import { layoutImgMap } from '@/config/constant.js'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:14
* @Desc: 结构
*/
export default { export default {
name: 'Structure',
components: { components: {
Sidebar Sidebar
}, },
@ -63,11 +58,6 @@ export default {
} }
}, },
methods: { methods: {
/**
* @Author: 王林
* @Date: 2021-06-24 23:04:38
* @Desc: 使用主题
*/
useLayout(layout) { useLayout(layout) {
this.layout = layout.value this.layout = layout.value
this.mindMap.setLayout(layout.value) this.mindMap.setLayout(layout.value)

View File

@ -551,8 +551,8 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import Color from './Color' import Color from './Color.vue'
import { import {
fontFamilyList, fontFamilyList,
fontSizeList, fontSizeList,
@ -566,13 +566,8 @@ import {
} from '@/config' } from '@/config'
import { mapState } from 'vuex' import { mapState } from 'vuex'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:47
* @Desc: 节点样式设置
*/
export default { export default {
name: 'Style',
components: { components: {
Sidebar, Sidebar,
Color Color
@ -658,11 +653,7 @@ export default {
this.$bus.$off('node_active', this.onNodeActive) this.$bus.$off('node_active', this.onNodeActive)
}, },
methods: { methods: {
/** //
* @Author: 王林25
* @Date: 2022-11-14 19:16:21
* @Desc: 监听节点激活事件
*/
onNodeActive(...args) { onNodeActive(...args) {
this.$nextTick(() => { this.$nextTick(() => {
this.activeNodes = [...args[1]] this.activeNodes = [...args[1]]
@ -670,11 +661,7 @@ export default {
}) })
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 09:48:52
* @Desc: 初始节点样式
*/
initNodeStyle() { initNodeStyle() {
if (this.activeNodes.length <= 0) { if (this.activeNodes.length <= 0) {
return return
@ -702,11 +689,7 @@ export default {
} }
}, },
/** //
* @Author: 王林
* @Date: 2021-05-04 22:08:16
* @Desc: 修改样式
*/
update(prop) { update(prop) {
if (prop === 'linearGradientDir') { if (prop === 'linearGradientDir') {
const target = this.linearGradientDirList.find(item => { const target = this.linearGradientDirList.find(item => {
@ -725,11 +708,7 @@ export default {
} }
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 09:41:34
* @Desc: 切换加粗样式
*/
toggleFontWeight() { toggleFontWeight() {
if (this.style.fontWeight === 'bold') { if (this.style.fontWeight === 'bold') {
this.style.fontWeight = 'normal' this.style.fontWeight = 'normal'
@ -739,11 +718,7 @@ export default {
this.update('fontWeight') this.update('fontWeight')
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 09:46:39
* @Desc: 切换字体样式
*/
toggleFontStyle() { toggleFontStyle() {
if (this.style.fontStyle === 'italic') { if (this.style.fontStyle === 'italic') {
this.style.fontStyle = 'normal' this.style.fontStyle = 'normal'
@ -753,61 +728,37 @@ export default {
this.update('fontStyle') this.update('fontStyle')
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 10:18:59
* @Desc: 修改字体颜色
*/
changeFontColor(color) { changeFontColor(color) {
this.style.color = color this.style.color = color
this.update('color') this.update('color')
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 10:18:59
* @Desc: 修改边框颜色
*/
changeBorderColor(color) { changeBorderColor(color) {
this.style.borderColor = color this.style.borderColor = color
this.update('borderColor') this.update('borderColor')
}, },
/** // 线
* @Author: flydreame
* @Date: 2022-09-17 10:18:15
* @Desc: 修改线条颜色
*/
changeLineColor(color) { changeLineColor(color) {
this.style.lineColor = color this.style.lineColor = color
this.update('lineColor') this.update('lineColor')
}, },
/** //
* @Author: 王林
* @Date: 2021-05-05 10:18:59
* @Desc: 修改背景颜色
*/
changeFillColor(color) { changeFillColor(color) {
this.style.fillColor = color this.style.fillColor = color
this.update('fillColor') this.update('fillColor')
}, },
/** //
* @Author: lxr_cel
* @Date: 2024-01-02 11:09:27
* @Desc: 切换渐变开始颜色
*/
changeStartColor(color) { changeStartColor(color) {
this.style.startColor = color this.style.startColor = color
this.update('startColor') this.update('startColor')
}, },
/** //
* @Author: lxr_cel
* @Date: 2024-01-02 10:10:34
* @Desc: 切换渐变结束颜色
*/
changeEndColor(color) { changeEndColor(color) {
this.style.endColor = color this.style.endColor = color
this.update('endColor') this.update('endColor')

View File

@ -26,19 +26,14 @@
</template> </template>
<script> <script>
import Sidebar from './Sidebar' import Sidebar from './Sidebar.vue'
import { storeConfig } from '@/api' import { storeConfig } from '@/api'
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
import themeImgMap from 'simple-mind-map-plugin-themes/themeImgMap' import themeImgMap from 'simple-mind-map-plugin-themes/themeImgMap'
import themeList from 'simple-mind-map-plugin-themes/themeList' import themeList from 'simple-mind-map-plugin-themes/themeList'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:53:04
* @Desc: 主题
*/
export default { export default {
name: 'Theme',
components: { components: {
Sidebar Sidebar
}, },

View File

@ -143,13 +143,13 @@
</template> </template>
<script> <script>
import NodeImage from './NodeImage' import NodeImage from './NodeImage.vue'
import NodeHyperlink from './NodeHyperlink' import NodeHyperlink from './NodeHyperlink.vue'
import NodeIcon from './NodeIcon' import NodeIcon from './NodeIcon.vue'
import NodeNote from './NodeNote' import NodeNote from './NodeNote.vue'
import NodeTag from './NodeTag' import NodeTag from './NodeTag.vue'
import Export from './Export' import Export from './Export.vue'
import Import from './Import' import Import from './Import.vue'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { Notification } from 'element-ui' import { Notification } from 'element-ui'
import exampleData from 'simple-mind-map/example/exampleData' import exampleData from 'simple-mind-map/example/exampleData'
@ -157,11 +157,7 @@ import { getData } from '../../../api'
import ToolbarNodeBtnList from './ToolbarNodeBtnList.vue' import ToolbarNodeBtnList from './ToolbarNodeBtnList.vue'
import { throttle, isMobile } from 'simple-mind-map/src/utils/index' import { throttle, isMobile } from 'simple-mind-map/src/utils/index'
/** //
* @Author: 王林
* @Date: 2021-06-24 22:54:58
* @Desc: 工具栏
*/
let fileHandle = null let fileHandle = null
const defaultBtnList = [ const defaultBtnList = [
'back', 'back',
@ -185,7 +181,6 @@ const defaultBtnList = [
] ]
export default { export default {
name: 'Toolbar',
components: { components: {
NodeImage, NodeImage,
NodeHyperlink, NodeHyperlink,

View File

@ -1,8 +1,4 @@
/** // 全屏事件检测
* @Author: 王林
* @Date: 2021-07-11 21:38:09
* @Desc: 全屏事件检测
*/
const getOnfullscreEnevt = () => { const getOnfullscreEnevt = () => {
if (document.documentElement.requestFullScreen) { if (document.documentElement.requestFullScreen) {
return 'onfullscreenchange' return 'onfullscreenchange'
@ -17,11 +13,7 @@ const getOnfullscreEnevt = () => {
export const fullscrrenEvent = getOnfullscreEnevt() export const fullscrrenEvent = getOnfullscreEnevt()
/** // 全屏
* @Author: 王林
* @Date: 2021-07-11 21:45:06
* @Desc: 全屏
*/
export const fullScreen = element => { export const fullScreen = element => {
if (element.requestFullScreen) { if (element.requestFullScreen) {
element.requestFullScreen() element.requestFullScreen()
@ -32,12 +24,7 @@ export const fullScreen = element => {
} }
} }
/** // 文件转buffer
* javascript comment
* @Author: 王林25
* @Date: 2022-10-24 14:16:18
* @Desc: 文件转buffer
*/
export const fileToBuffer = file => { export const fileToBuffer = file => {
return new Promise(r => { return new Promise(r => {
const reader = new FileReader() const reader = new FileReader()