提交 5936e693 编写于 作者: W wanganxp

dom

上级 3529b58a
## CSSStyleDeclaration
# CSSStyleDeclaration
CSSStyleDeclaration表示一个CSS 声明块对象,它是一个 CSS 属性键值对的集合。它暴露了样式信息和各种与样式相关的方法和属性。
......@@ -8,7 +8,7 @@ CSSStyleDeclaration表示一个CSS 声明块对象,它是一个 CSS 属性键
| [getPropertyValue](#getPropertyValue) | 获取CSS的某个样式值 |
### setProperty(name, value)@setProperty
## setProperty(name, value)@setProperty
对CSS指定样式设置一个新值。
......@@ -28,7 +28,7 @@ CSSStyleDeclaration.setProperty(name:string, value:any):void
### getPropertyValue(property)@getPropertyValue
## getPropertyValue(property)@getPropertyValue
获取CSS指定的样式值,如果指定的样式不存在则返回null。
......@@ -47,3 +47,22 @@ CSSStyleDeclaration.getPropertyValue(property:string):any?
| 类型 | 说明 |
|------ |---------- |
| any | CSS样式值,可能为null |
## 示例
```html
<template>
<button @click="showPop">显示弹层</button>
<view ref="pop" style="position: absolute; display: none;">
<text>123</text>
</view>
</template>
<script lang="uts">
export default {
methods: {
showPop: function () {
(this.$refs["pop"] as INode).style.setProperty("display","flex")
}
}
}
</script>
```
\ No newline at end of file
......@@ -2,19 +2,19 @@
| 属性 | 说明 |
|-------------------------------------- |-------------------------- |
| [style](#style) | 组件样式列表对象,参考[CSSStyleDeclaration](cssstyle.md)|
| [style](#style) | 组件样式列表对象,参考[CSSStyleDeclaration](cssstyledeclaration.md)|
| 方法 | 说明 |
|-------------------------------------- |-------------------------- |
| [setAttribute](#setAttribute) | 设置组件的某个属性值 |
| [getAttribute](#getAttribute) | 获取组件指定的属性值 |
| [getDrawableContext](#getAttribute) | 获取组件的绘制对象 |
| [getDrawableContext](#getDrawableContext) | 获取组件的绘制对象 |
### style@style
组件的CSS样式列表对象,只读属性。可以通过其 setProperty 方法更新组件的样式。
组件的CSS样式列表对象,只读属性。可以通过其 setProperty 方法更新组件的样式。[详见](cssstyledeclaration.md)
```ts
node.style;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册