ngui/css
css
樣式表類似于html css
樣式表,支持使用多級(jí)樣式表,但只支持class
類3
種偽類型normal
、hover
、down
對(duì)應(yīng)View.onHighlighted
事件中的 HIGHLIGHTED_NORMAL
、HIGHLIGHTED_HOVER
、HIGHLIGHTED_DOWN
但需要注意先后順序小心直接賦值會(huì)被樣式表覆蓋,
因?yàn)槊看涡薷牡臉邮奖聿粫?huì)立即生效都會(huì)在渲染前才應(yīng)用到視圖。
sheets
{Object
}sheets
{Object
}Example:
import CSS from 'ngui/css'
import { GUIApplication, Root, Div } from 'ngui'
import 'ngui/dialog'
// 樣式表都是全局的
CSS({
'.test': {
width: '50%',
height: '50%',
backgroundColor: '#00f',
},
'.test .a': {
width: 50,
height: 50,
},
'.test .a.b': { // 這種選擇器會(huì)優(yōu)先級(jí)會(huì)更高
height: 60,
},
// 應(yīng)用這些偽類到目標(biāo),要使用它們對(duì)目標(biāo)生效,需目標(biāo)視圖能夠接收事件
'.test:normal .a': {
backgroundColor: '#0000',
},
'.test:hover': {
backgroundColor: '#f0f',
},
'.test:hover .a': {
backgroundColor: '#f00',
},
})
new GUIApplication().start(
// 需要注意jsx語(yǔ)法只能存在于.jsx文件中
<Root>
<Div class="test"onClick=(e=>{ dialog.alert('Hello!') })>
<Div class="a b" />
</Div>
</Root>
)
Enum PropertyName
KeyframeAction
中Frame
所支持的所有動(dòng)作屬性
更多建議: