Feat:addContentToHeader方法支持返回空数据
This commit is contained in:
parent
f0c08c7953
commit
614aa1ec30
@ -309,7 +309,7 @@ export const defaultOpt = {
|
|||||||
*/
|
*/
|
||||||
},
|
},
|
||||||
// 导出png、svg、pdf时在头部和尾部添加自定义内容
|
// 导出png、svg、pdf时在头部和尾部添加自定义内容
|
||||||
// 可传递一个函数,这个函数需要返回如下数据:
|
// 可传递一个函数,这个函数可以返回null代表不添加内容,也可以返回如下数据:
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
el,// 要追加的自定义DOM节点,样式可内联
|
el,// 要追加的自定义DOM节点,样式可内联
|
||||||
|
|||||||
@ -1330,7 +1330,9 @@ export const handleGetSvgDataExtraContent = ({
|
|||||||
let footerHeight = 0
|
let footerHeight = 0
|
||||||
const handle = (fn, callback) => {
|
const handle = (fn, callback) => {
|
||||||
if (typeof fn === 'function') {
|
if (typeof fn === 'function') {
|
||||||
const { el, cssText, height } = fn()
|
const res = fn()
|
||||||
|
if (!res) return
|
||||||
|
const { el, cssText, height } = res
|
||||||
if (el instanceof HTMLElement) {
|
if (el instanceof HTMLElement) {
|
||||||
el.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml')
|
el.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml')
|
||||||
const foreignObject = new ForeignObject()
|
const foreignObject = new ForeignObject()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user