slider_checkboxgroup

Signed-off-by: zhangjinyu101 <zhangjinyu101@huawei.com>
This commit is contained in:
zhangjinyu101 2024-10-11 10:14:20 +08:00
parent c199cdd8ff
commit 5576468e30
2 changed files with 17 additions and 5 deletions

View File

@ -49,7 +49,7 @@ export struct CheckboxGroupBootcamp {
Column() {
// 全选按钮
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
CheckboxGroup({ group: 'checkboxGroup' })
.checkboxShape(useEnabled(this.enableCheckboxGroupShape, this.checkboxGroupShape))
.enabled(useEnabled(this.enableCheckboxGroup, this.enable))
@ -61,8 +61,9 @@ export struct CheckboxGroupBootcamp {
}
// 选项1
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
.shape(useEnabled(this.enableCheckboxGroupShape, this.checkboxGroupShape))
.select(true)
.onChange((value: boolean) => {
console.info(`Checkbox1 change is ${value}`)
@ -71,8 +72,9 @@ export struct CheckboxGroupBootcamp {
}
// 选项2
Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Checkbox({ name: 'checkbox2', group: 'checkboxGroup' })
.shape(useEnabled(this.enableCheckboxGroupShape, this.checkboxGroupShape))
.onChange((value: boolean) => {
console.info(`Checkbox2 change is ${value}`)
})

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import { RadioBlock, useEnabled } from 'common';
import { RadioBlock, useEnabled, SliderBlock } from 'common';
import { Drawer } from 'common/src/main/ets/components/Drawer';
@Component
@ -24,6 +24,8 @@ export struct SliderBootcamp {
@State sliderStyle: SliderStyle = SliderStyle.OutSet;
@State enableShowSteps: boolean = false;
@State showSteps: boolean = false;
@State enableStep: boolean = false;
@State step: number = 1;
@State enableShowTips: boolean = false;
@State showTips: boolean = false;
@State enableDirection: boolean = false;
@ -49,7 +51,7 @@ export struct SliderBootcamp {
@Builder
Content() {
Column({ space: 8 }) {
Slider({ style: useEnabled(this.enableSliderStyle, this.sliderStyle) })
Slider({ style: useEnabled(this.enableSliderStyle, this.sliderStyle), step: this.step })
.showTips(useEnabled(this.enableShowTips, this.showTips))
.showSteps(useEnabled(this.enableShowSteps, this.showSteps))
.direction(useEnabled(this.enableDirection, this.currentDirection))
@ -80,6 +82,14 @@ export struct SliderBootcamp {
]
})
SliderBlock({
title: '间续滑动步长',
isEnabled: this.enableStep,
value: this.step,
min: 1,
max: 20
})
RadioBlock({
title: '是否显示气泡',
isEnabled: this.enableShowTips,