Add css
parent
9ea9849471
commit
a8b047ee20
|
@ -0,0 +1,21 @@
|
||||||
|
## `css`函数
|
||||||
|
> 这个函数, 内部做了兼容处理, 在支持`adoptedStyleSheets`的浏览器上自动使用`adoptedStyleSheets`, 否则转为使用style标签实现。
|
||||||
|
>> 同时,配合VSCODE插件`string-html-css`, 可实现css语法高亮。
|
||||||
|
|
||||||
|
### 注意
|
||||||
|
> 虽然配合vscode插件, 可以`scss`语汪高亮, 但是`css()`函数本身并不支持解析`scss`的。
|
||||||
|
如果需要使用`scss`, 需要使用`wkit`的配套的构建工具来编译。
|
||||||
|
|
||||||
|
|
||||||
|
```js
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Foo extends Component {
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
.foo { color: red }
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
Loading…
Reference in New Issue