提交 b64ca8f5 编写于 作者: Y yamila 提交者: yamila89

fixed 770ebd43 from https://gitee.com/yamila89/docs/pulls/18840

update textPickerDialog
Signed-off-by: Nyamila <tianyu55@huawei.com>
Signed-off-by: Nyamila89 <tianyu55@huawei.com>
上级 1804f1ad
...@@ -94,7 +94,7 @@ struct FancyUse { ...@@ -94,7 +94,7 @@ struct FancyUse {
Text('FancyA') Text('FancyA')
.globalFancy () .globalFancy ()
.fontSize(30) .fontSize(30)
// 使用全局的@Styles封装的样式 // 使用组件内的@Styles封装的样式
Text('FancyB') Text('FancyB')
.fancy() .fancy()
.fontSize(30) .fontSize(30)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
> >
> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> >
> 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用。 > 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用,需要在创建组件实例后使用
## 导入模块 ## 导入模块
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
> >
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
> >
> 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用。 > 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用,需要在创建组件实例后使用
## 导入模块 ## 导入模块
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
> >
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> >
> 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用。 > 该模块不支持在[UIAbility](./js-apis-app-ability-uiAbility.md)中使用,需要在创建组件实例后使用
## 导入模块 ## 导入模块
......
...@@ -86,3 +86,5 @@ struct DatePickerDialogExample { ...@@ -86,3 +86,5 @@ struct DatePickerDialogExample {
} }
} }
``` ```
![DataPickerDialog](figures/DataPickerDialog.gif)
\ No newline at end of file
...@@ -42,20 +42,21 @@ show(options?: TextPickerDialogOptions) ...@@ -42,20 +42,21 @@ show(options?: TextPickerDialogOptions)
@Entry @Entry
@Component @Component
struct TextPickerDialogExample { struct TextPickerDialogExample {
@State select: number = 2 @State select: number[] = [2]
private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5'] private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5']
build() { build() {
Row() {
Column() { Column() {
Button("TextPickerDialog") Button("TextPickerDialog")
.margin(20) .margin(20)
.onClick(() => { .onClick(() => {
TextPickerDialog.show({ TextPickerDialog.show({
range: this.fruits, range: this.fruits,
selected: this.select, selected: this.select[0],
onAccept: (value: TextPickerResult) => { onAccept: (value: TextPickerResult) => {
// 设置select为按下确定按钮时候的选中项index,这样当弹窗再次弹出时显示选中的是上一次确定的选项 // 设置select为按下确定按钮时候的选中项index,这样当弹窗再次弹出时显示选中的是上一次确定的选项
this.select = value.index this.select[0] = value.index
console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) console.info("TextPickerDialog:onAccept()" + JSON.stringify(value))
}, },
onCancel: () => { onCancel: () => {
...@@ -67,6 +68,9 @@ struct TextPickerDialogExample { ...@@ -67,6 +68,9 @@ struct TextPickerDialogExample {
}) })
}) })
}.width('100%') }.width('100%')
}.height('100%')
} }
} }
``` ```
![TextPickerDialog](figures/TextPickerDialog.gif)
\ No newline at end of file
...@@ -77,3 +77,5 @@ struct TimePickerDialogExample { ...@@ -77,3 +77,5 @@ struct TimePickerDialogExample {
} }
} }
``` ```
![TimetPickerDialog](figures/TimePickerDialog.gif)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册