diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index cab8da64..7e8d6346 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -309,7 +309,7 @@ export const defaultOpt = { */ }, // 导出png、svg、pdf时在头部和尾部添加自定义内容 - // 可传递一个函数,这个函数需要返回如下数据: + // 可传递一个函数,这个函数可以返回null代表不添加内容,也可以返回如下数据: /* { el,// 要追加的自定义DOM节点,样式可内联 diff --git a/simple-mind-map/src/utils/index.js b/simple-mind-map/src/utils/index.js index d234d976..3066d477 100644 --- a/simple-mind-map/src/utils/index.js +++ b/simple-mind-map/src/utils/index.js @@ -1330,7 +1330,9 @@ export const handleGetSvgDataExtraContent = ({ let footerHeight = 0 const handle = (fn, callback) => { if (typeof fn === 'function') { - const { el, cssText, height } = fn() + const res = fn() + if (!res) return + const { el, cssText, height } = res if (el instanceof HTMLElement) { el.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml') const foreignObject = new ForeignObject()