mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-21 18:37:43 +08:00
Demo:扩展节点图标列表
This commit is contained in:
parent
5e865a4e33
commit
f5f665ec0a
64
web/src/config/icon.js
Normal file
64
web/src/config/icon.js
Normal file
File diff suppressed because one or more lines are too long
@ -48,6 +48,7 @@ import NodeImgPreview from './NodeImgPreview.vue'
|
||||
import SidebarTrigger from './SidebarTrigger.vue'
|
||||
import { mapState } from 'vuex'
|
||||
import customThemeList from '@/customThemes'
|
||||
import icon from '@/config/icon'
|
||||
|
||||
// 注册插件
|
||||
MindMap
|
||||
@ -287,7 +288,8 @@ export default {
|
||||
// this.$bus.$emit('hideNoteContent')
|
||||
}
|
||||
},
|
||||
...(config || {})
|
||||
...(config || {}),
|
||||
iconList: icon
|
||||
})
|
||||
if (this.openNodeRichText) this.addRichTextPlugin()
|
||||
this.mindMap.keyCommand.addShortcut('Control+s', () => {
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
class="icon"
|
||||
v-for="icon in item.list"
|
||||
:key="icon.name"
|
||||
v-html="icon.icon"
|
||||
v-html="getHtml(icon.icon)"
|
||||
:class="{
|
||||
selected: iconList.includes(item.type + '_' + icon.name)
|
||||
}"
|
||||
@ -25,6 +25,7 @@
|
||||
|
||||
<script>
|
||||
import { nodeIconList } from 'simple-mind-map/src/svg/icons'
|
||||
import icon from '@/config/icon'
|
||||
|
||||
/**
|
||||
* @Author: 王林
|
||||
@ -35,7 +36,7 @@ export default {
|
||||
name: 'NodeIcon',
|
||||
data() {
|
||||
return {
|
||||
nodeIconList,
|
||||
nodeIconList: [...nodeIconList, ...icon],
|
||||
dialogVisible: false,
|
||||
iconList: [],
|
||||
activeNodes: []
|
||||
@ -56,6 +57,10 @@ export default {
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getHtml(icon) {
|
||||
return /^<svg/.test(icon) ? icon : `<img src="${icon}" />`
|
||||
},
|
||||
|
||||
/**
|
||||
* @Author: 王林
|
||||
* @Date: 2021-06-23 23:16:56
|
||||
@ -119,6 +124,16 @@ export default {
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
/deep/ img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/deep/ svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
&::after {
|
||||
content: '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user