微调adoptedStyleSheets的赋值, 兼容国产辣鸡浏览器

pull/1/head
yutent 2023-05-29 10:03:33 +08:00
parent 1a12b21cc2
commit 408ba6ca2f
4 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ class Hello extends Component {
bar: String // 简写 bar: String // 简写
} }
// 若需要支持 scss, 则需要使用 @bd/wcui-cli,预处理 // 若需要支持 scss语法, 则需要使用构建工具编译
// 可支持数组 // 可支持数组
static styles = css` static styles = css`
button { color: #09f; } button { color: #09f; }

View File

@ -1,6 +1,6 @@
{ {
"name": "wkit", "name": "wkit",
"version": "1.9.5", "version": "1.9.6",
"type": "module", "type": "module",
"description": "A library for building fast, lightweight web components.", "description": "A library for building fast, lightweight web components.",
"main": "dist/index.js", "main": "dist/index.js",

View File

@ -37,7 +37,7 @@ export function adoptStyles(root, styles = '') {
styles = (RESET_CSS_STYLE + styles.join(' ')).trim() styles = (RESET_CSS_STYLE + styles.join(' ')).trim()
sheet.replaceSync(styles) sheet.replaceSync(styles)
if (root.adoptedStyleSheets) { if (root.adoptedStyleSheets) {
root.adoptedStyleSheets.push(sheet) root.adoptedStyleSheets = [sheet]
} else { } else {
root.appendChild(sheet.elem) root.appendChild(sheet.elem)
} }

View File

@ -1,5 +1,5 @@
/** /**
* {@bd/ui的核心库} * { wkit library }
* @author yutent<yutent.io@gmail.com> * @author yutent<yutent.io@gmail.com>
* @date 2023/03/07 18:10:43 * @date 2023/03/07 18:10:43
*/ */