From 0cc279f570b6aa931f1ddc1429ef60e5837a4cb1 Mon Sep 17 00:00:00 2001 From: LiAn Date: Tue, 22 Aug 2023 09:13:21 +0000 Subject: [PATCH] update zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-drag-drop.md. Signed-off-by: LiAn Signed-off-by: LiAn --- .../arkui-ts/ts-universal-attributes-drag-drop.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-drag-drop.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-drag-drop.md index 7ae4b508d8..0abf748e6b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-drag-drop.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-drag-drop.md @@ -29,7 +29,8 @@ ArkUI组件默认支持拖拽。 ```ts // xxx.ets -import UDMF from '@ohos.data.UDMF'; +import UDC from '@ohos.data.unifiedDataChannel'; +import UTD from '@ohos.data.uniformTypeDescriptor'; @Entry @Component struct ImageExample { @@ -44,7 +45,7 @@ struct ImageExample { Text('Image拖拽') .fontSize('30dp') Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) { - Image($r('app.media.1')) + Image($r('app.media.icon')) .width(100) .height(100) .border({ width: 1 }) @@ -80,7 +81,7 @@ struct ImageExample { } .height('90%') .width('100%') - .allowDrop(["File.Media.Text", "File.Media.Image"]) + .allowDrop([UTD.UniformDataType.TEXT, UTD.UniformDataType.IMAGE]) .onDrop((event: DragEvent, extraParams: string) => { let jsonString = JSON.parse(extraParams); this.uri = jsonString.extraInfo; @@ -111,7 +112,7 @@ struct ImageExample { .border({width: 1}) .height('90%') .width('100%') - .allowDrop(["File.Media.Image"]) + .allowDrop([UTD.UniformDataType.IMAGE]) .onDrop((event: DragEvent, extraParams: string) => { console.log("enter onDrop") let dragData = event.getData(); @@ -119,7 +120,7 @@ struct ImageExample { if(dragData != undefined) { let arr = dragData.getRecords(); if(arr.length > 0) { - let image = (arr[0]); + let image = (arr[0]); this.uri = image.imageUri; let jsonString = JSON.parse(extraParams); this.BblockArr.splice(jsonString.insertIndex, 0, this.uri); -- GitLab