动态添加css/** * 添加样式 * @param css * @returns {HTMLStyleElement} 添加的样式 */ export function addCustomStyle(css) { const style = document.createElement("style"); style.appendChild(document.createTextNode(css)); const head = document.getElementsByTagName("head")[0]; head.appendChild(style); return style }这么使用 // 添加样式 this.style = addCustomStyle(style); // 如果想移除添加的样式 this.style.remove()
动态添加css
这么使用