diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textpicker.gif b/zh-cn/application-dev/reference/arkui-ts/figures/textpicker.gif new file mode 100644 index 0000000000000000000000000000000000000000..883d9ce7b8afa3907c0f9441019622339aac294d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textpicker.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219662657.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219662657.png deleted file mode 100644 index 999ad44c80a018d45353044e13923a8566bf3cf0..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219662657.png and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md index b4d5e256f0829c6f9c07da40ffa44f51fe774c2f..99b6375a1342a17ed635365c677ef499d46c6987 100755 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md @@ -71,17 +71,48 @@ TextPicker(options?: {range: string[] | string[][] | Resource | TextPickerRangeC @Component struct TextPickerExample { private select: number = 1 - private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4'] + private apfruits: string[] = ['apple1', 'apple2', 'apple3', 'apple4'] + private orfruits: string[] = ['orange1', 'orange2', 'orange3', 'orange4'] + private pefruits: string[] = ['peach1', 'peach2', 'peach3', 'peach4'] + private multi: string[][] = [this.apfruits, this.orfruits, this.pefruits] + private cascade: TextCascadePickerRangeContent[] = [ + { + text: '辽宁省', + children: [{ text: '沈阳市', children: [{ text: '沈河区' }, { text: '和平区' }, { text: '浑南区' }] }, + { text: '大连市', children: [{ text: '中山区' }, { text: '金州区' }, { text: '长海县' }] }] + }, + { + text: '吉林省', + children: [{ text: '长春市', children: [{ text: '南关区' }, { text: '宽城区' }, { text: '朝阳区' }] }, + { text: '四平市', children: [{ text: '铁西区' }, { text: '铁东区' }, { text: '梨树县' }] }] + }, + { + text: '黑龙江省', + children: [{ text: '哈尔滨市', children: [{ text: '道里区' }, { text: '道外区' }, { text: '南岗区' }] }, + { text: '牡丹江市', children: [{ text: '东安区' }, { text: '西安区' }, { text: '爱民区' }] }] + } + ] build() { Column() { - TextPicker({ range: this.fruits, selected: this.select }) + + TextPicker({ range: this.apfruits, selected: this.select }) .onChange((value: string, index: number) => { console.info('Picker item changed, value: ' + value + ', index: ' + index) + }).margin({ bottom: 50 }) + + TextPicker({ range: this.multi }) + .onChange((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列:onChange ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)) + }).margin({ bottom: 50 }) + + TextPicker({ range: this.cascade }) + .onChange((value: string | string[], index: number | number[]) => { + console.info('TextPicker 多列联动:onChange ' + JSON.stringify(value) + ', ' + 'index: ' + JSON.stringify(index)) }) } } } ``` -![zh-cn_image_0000001219662657](figures/zh-cn_image_0000001219662657.png) +![textpicker](figures/textpicker.gif)