Button
概述[按钮]
<Button /> 是一个自带点击效果(点击时具有 0.5 透明度)的按钮组件。
注意:
<Button />是一个单一子节点组件!
示例代码
import cooApp, { basicWidgets } from 'coolink'
const { Button, Text } = basicWidgets
export default class ImageItem extends cooApp.Widget {
render () {
return {
<Button>
<Text>这是一个按钮</Text>
</Button>
}
}
}
组件属性
无
样例 1
state = {
count: 0
}
buttonStyles = {
width: 100,
padding: 10,
borderRadius: 5,
backgroundColor: Colors.Primary
}
render() {
return (
<Page appBar={<AppBar title="但行好事,莫问前程" />}>
<Container width={800} row justifyContent="spaceAround">
<Button {...this.buttonStyles} onTap={
() => {
this.setState({
count: this.state.count-1
})
}
}
>
<Text color={Colors.White}>芭比Q减1</Text>
</Button>
<Button {...this.buttonStyles} onTap={
() => {
this.setState({
count: this.state.count+1
})
}
}
>
<Text color={Colors.White}>芭比Q加1</Text>
</Button>
</Container>
</Page>
)
}
上述例子的效果图:

©深圳市酷开网络科技股份有限公司 ICP备案号粤ICP备06098778号
