Commit 388dc28f authored by Allen Bai's avatar Allen Bai

feat: dom的获取支持函数

parent 858dfade
......@@ -62,7 +62,7 @@ type IPCFooterOptions = {
/** 自定义域名,默认自动从url取 */
domain?: string
/** 要挂载的dom节点,默认为body */
dom?: HTMLElement | string
dom?: HTMLElement | string | (() => HTMLElement)
/** 延迟几秒渲染,默认300毫秒 */
delay?: number
/** 页脚样式 */
......@@ -143,6 +143,8 @@ async function mountIPCFooter(opts: IPCFooterOptions = {}) {
targetDom = document.querySelector('body')
} else if (typeof opts.dom === 'string') {
targetDom = document.querySelector(opts.dom)
} else if (typeof opts.dom === 'function') {
targetDom = opts.dom()
} else {
targetDom = opts.dom
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment