t-comm
Version:
专业、稳定、纯粹的工具库
37 lines (36 loc) • 927 B
TypeScript
/**
* 向页面 head 中插入 style 标签
* 如果已存在相同 id 的 style 标签,会先移除再插入新的
* @param options - 配置选项
* @param options.id - style 标签的 id
* @param options.content - CSS 样式内容
* @example
* ```ts
* insertStyle({
* id: 'custom-style',
* content: '.my-class { color: red; }'
* });
* ```
*/
export declare function insertStyle({ id, content, }: {
id: string;
content: string;
}): void;
/**
* 向页面 body 中插入隐藏的 HTML 元素
* 如果已存在相同 id 的元素,会先移除再插入新的
* @param options - 配置选项
* @param options.id - div 元素的 id
* @param options.content - HTML 内容
* @example
* ```ts
* insertHtml({
* id: 'hidden-content',
* content: '<div>隐藏的内容</div>'
* });
* ```
*/
export declare function insertHtml({ id, content, }: {
id: string;
content: string;
}): void;