Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e95b4f8b
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e95b4f8b
编写于
10月 08, 2022
作者:
L
luoying_ace
提交者:
Gitee
10月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md.
Signed-off-by:
N
luoying_ace
<
luoying19@huawei.com
>
上级
ad1e572b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
19 deletion
+19
-19
zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
...n-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
+19
-19
未找到文件。
zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md
浏览文件 @
e95b4f8b
...
...
@@ -36,9 +36,9 @@
| selectedIndex | number | 当拖拽事件设在父容器的子元素时,selectedIndex表示当前被拖拽子元素是父容器第selectedIndex个子元素,selectedIndex从0开始。
<br/>
仅在ListItem组件的拖拽事件中生效。 |
| insertIndex | number | 当前拖拽元素在List组件中放下时,insertIndex表示被拖拽元素插入该组件的第insertIndex个位置,insertIndex从0开始。
<br/>
仅在List组件的拖拽事件中生效。 |
## DragEvent
对象
说明
## DragEvent说明
| 名称 |
返回值类型 | 功能
描述 |
| 名称 |
类型 |
描述 |
| ------ | ------ | ---------------- |
| getX() | number | 当前拖拽点x轴坐标,单位为vp。 |
| getY() | number | 当前拖拽点y轴坐标,单位为vp。 |
...
...
@@ -87,10 +87,10 @@ struct DragExample {
.
backgroundColor
(
0xAFEEEE
)
.
visibility
(
this
.
appleVisible
)
.
onDragStart
(()
=>
{
this
.
bool
=
true
this
.
text
=
'
apple
'
this
.
appleVisible
=
Visibility
.
None
return
this
.
pixelMapBuilder
this
.
bool
=
true
;
this
.
text
=
'
apple
'
;
this
.
appleVisible
=
Visibility
.
None
;
return
this
.
pixelMapBuilder
;
})
Text
(
'
orange
'
)
.
width
(
'
25%
'
)
...
...
@@ -100,10 +100,10 @@ struct DragExample {
.
backgroundColor
(
0xAFEEEE
)
.
visibility
(
this
.
orangeVisible
)
.
onDragStart
(()
=>
{
this
.
bool
=
true
this
.
text
=
'
orange
'
this
.
orangeVisible
=
Visibility
.
None
return
this
.
pixelMapBuilder
this
.
bool
=
true
;
this
.
text
=
'
orange
'
;
this
.
orangeVisible
=
Visibility
.
None
;
return
this
.
pixelMapBuilder
;
})
Text
(
'
banana
'
)
.
width
(
'
25%
'
)
...
...
@@ -113,11 +113,11 @@ struct DragExample {
.
backgroundColor
(
0xAFEEEE
)
.
visibility
(
this
.
bananaVisible
)
.
onDragStart
((
event
:
DragEvent
,
extraParams
:
string
)
=>
{
console
.
log
(
'
Text onDragStart
s,
'
+
extraParams
)
this
.
bool
=
true
this
.
text
=
'
banana
'
this
.
bananaVisible
=
Visibility
.
None
return
this
.
pixelMapBuilder
console
.
log
(
'
Text onDragStart
,
'
+
extraParams
+
'
X:
'
+
event
.
getX
()
+
'
Y:
'
+
event
.
getY
());
this
.
bool
=
true
;
this
.
text
=
'
banana
'
;
this
.
bananaVisible
=
Visibility
.
None
;
return
this
.
pixelMapBuilder
;
})
}.
padding
({
top
:
10
,
bottom
:
10
}).
margin
(
10
)
...
...
@@ -147,16 +147,16 @@ struct DragExample {
.
padding
(
15
)
.
divider
({
strokeWidth
:
2
,
color
:
0xFFFFFF
,
startMargin
:
20
,
endMargin
:
20
})
.
onDragEnter
((
event
:
DragEvent
,
extraParams
:
string
)
=>
{
console
.
log
(
'
List onDragEnter,
'
+
extraParams
)
console
.
log
(
'
List onDragEnter,
'
+
extraParams
+
'
X:
'
+
event
.
getX
()
+
'
Y:
'
+
event
.
getY
());
})
.
onDragMove
((
event
:
DragEvent
,
extraParams
:
string
)
=>
{
console
.
log
(
'
List onDragMove,
'
+
extraParams
)
console
.
log
(
'
List onDragMove,
'
+
extraParams
+
'
X:
'
+
event
.
getX
()
+
'
Y:
'
+
event
.
getY
());
})
.
onDragLeave
((
event
:
DragEvent
,
extraParams
:
string
)
=>
{
console
.
log
(
'
List onDragLeave,
'
+
extraParams
)
console
.
log
(
'
List onDragLeave,
'
+
extraParams
+
'
X:
'
+
event
.
getX
()
+
'
Y:
'
+
event
.
getY
());
})
.
onDrop
((
event
:
DragEvent
,
extraParams
:
string
)
=>
{
var
jsonString
=
JSON
.
parse
(
extraParams
)
var
jsonString
=
JSON
.
parse
(
extraParams
)
;
if
(
this
.
bool
)
{
// 通过splice方法插入元素
this
.
numbers
.
splice
(
jsonString
.
insertIndex
,
0
,
this
.
text
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录