Feature:支持扩展节点图标
This commit is contained in:
parent
38ad33b604
commit
5e865a4e33
@ -105,7 +105,20 @@ const defaultOpt = {
|
|||||||
// 最大历史记录数
|
// 最大历史记录数
|
||||||
maxHistoryCount: 1000,
|
maxHistoryCount: 1000,
|
||||||
// 是否一直显示节点的展开收起按钮,默认为鼠标移上去和激活时才显示
|
// 是否一直显示节点的展开收起按钮,默认为鼠标移上去和激活时才显示
|
||||||
alwaysShowExpandBtn: false
|
alwaysShowExpandBtn: false,
|
||||||
|
// 扩展节点可插入的图标
|
||||||
|
iconList: [
|
||||||
|
// {
|
||||||
|
// name: '',// 分组名称
|
||||||
|
// type: '',// 分组的值
|
||||||
|
// list: [// 分组下的图标列表
|
||||||
|
// {
|
||||||
|
// name: '',// 图标名称
|
||||||
|
// icon:''// 图标,可以传svg或图片
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
// 思维导图
|
// 思维导图
|
||||||
|
|||||||
@ -279,9 +279,9 @@ export const nodeIconList = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// 获取nodeIconList icon内容
|
// 获取nodeIconList icon内容
|
||||||
const getNodeIconListIcon = name => {
|
const getNodeIconListIcon = (name, extendIconList = []) => {
|
||||||
let arr = name.split('_')
|
let arr = name.split('_')
|
||||||
let typeData = nodeIconList.find(item => {
|
let typeData = [...nodeIconList, ...extendIconList].find(item => {
|
||||||
return item.type === arr[0]
|
return item.type === arr[0]
|
||||||
})
|
})
|
||||||
return typeData.list.find(item => {
|
return typeData.list.find(item => {
|
||||||
|
|||||||
@ -42,8 +42,18 @@ function createIconNode() {
|
|||||||
}
|
}
|
||||||
let iconSize = this.mindMap.themeConfig.iconSize
|
let iconSize = this.mindMap.themeConfig.iconSize
|
||||||
return _data.icon.map(item => {
|
return _data.icon.map(item => {
|
||||||
|
let src = iconsSvg.getNodeIconListIcon(item, this.mindMap.opt.iconList || [])
|
||||||
|
let node = null
|
||||||
|
// svg图标
|
||||||
|
if (/^<svg/.test(src)) {
|
||||||
|
node = SVG(src)
|
||||||
|
} else {
|
||||||
|
// 图片图标
|
||||||
|
node = new Image().load(src)
|
||||||
|
}
|
||||||
|
node.size(iconSize, iconSize)
|
||||||
return {
|
return {
|
||||||
node: SVG(iconsSvg.getNodeIconListIcon(item)).size(iconSize, iconSize),
|
node,
|
||||||
width: iconSize,
|
width: iconSize,
|
||||||
height: iconSize
|
height: iconSize
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user