diff --git a/simple-mind-map/index.js b/simple-mind-map/index.js index 83fe8bb3..dd8e7fe6 100644 --- a/simple-mind-map/index.js +++ b/simple-mind-map/index.js @@ -72,7 +72,17 @@ const defaultOpt = { // 默认插入的二级节点的文字 defaultInsertSecondLevelNodeText: '二级节点', // 默认插入的二级以下节点的文字 - defaultInsertBelowSecondLevelNodeText: '分支主题' + defaultInsertBelowSecondLevelNodeText: '分支主题', + // 展开收起按钮的颜色 + expandBtnStyle: { + color: '#808080', + fill: '#fff' + }, + // 自定义展开收起按钮的图标 + expandBtnIcon: { + open: '',// svg字符串 + close: '' + } } // 思维导图 diff --git a/simple-mind-map/src/Style.js b/simple-mind-map/src/Style.js index 99dac586..72f109c9 100644 --- a/simple-mind-map/src/Style.js +++ b/simple-mind-map/src/Style.js @@ -170,9 +170,13 @@ class Style { // 展开收起按钮 iconBtn(node, node2, fillNode) { - node.fill({ color: '#808080' }) - node2.fill({ color: '#808080' }) - fillNode.fill({ color: '#fff' }) + let { color, fill } = this.ctx.mindMap.opt.expandBtnStyle || { + color: '#808080', + fill: '#fff' + } + node.fill({ color: color }) + node2.fill({ color: color }) + fillNode.fill({ color: fill }) } } diff --git a/simple-mind-map/src/utils/nodeExpandBtn.js b/simple-mind-map/src/utils/nodeExpandBtn.js index 1eb79c9a..2119863c 100644 --- a/simple-mind-map/src/utils/nodeExpandBtn.js +++ b/simple-mind-map/src/utils/nodeExpandBtn.js @@ -6,14 +6,15 @@ function createExpandNodeContent() { if (this._openExpandNode) { return } + let { open, close } = this.mindMap.opt.expandBtnIcon || {} // 展开的节点 - this._openExpandNode = SVG(btnsSvg.open).size( + this._openExpandNode = SVG(open || btnsSvg.open).size( this.expandBtnSize, this.expandBtnSize ) this._openExpandNode.x(0).y(-this.expandBtnSize / 2) // 收起的节点 - this._closeExpandNode = SVG(btnsSvg.close).size( + this._closeExpandNode = SVG(close || btnsSvg.close).size( this.expandBtnSize, this.expandBtnSize )