提交 1ff5ad8b 编写于 作者: Y yamila

update tabs and menu

Signed-off-by: Nyamila <tianyu55@huawei.com>
上级 c265a4ea
...@@ -12,7 +12,7 @@ tab页签容器。 ...@@ -12,7 +12,7 @@ tab页签容器。
## 子组件 ## 子组件
仅支持最多一个&lt;[tab-bar](../arkui-js/js-components-container-tab-bar.md)&gt;和最多一个&lt;[tab-content](../arkui-js/js-components-container-tab-content.md)&gt; 仅支持&lt;[tab-bar](../arkui-js/js-components-container-tab-bar.md)&gt;&lt;[tab-content](../arkui-js/js-components-container-tab-content.md)&gt;
## 属性 ## 属性
......
...@@ -17,26 +17,38 @@ close(): void ...@@ -17,26 +17,38 @@ close(): void
@Entry @Entry
@Component @Component
struct Index { struct Index {
@Builder MenuBuilder(){ @Builder MenuBuilder() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('close') Button('Test ContextMenu1')
.fontSize(30) Divider().strokeWidth(2).margin(5)
.fontWeight(FontWeight.Bold) Button('Test ContextMenu2')
.onClick(() => { Divider().strokeWidth(2).margin(5)
ContextMenu.close(); Button('Test ContextMenu3')
}) }
}.height(400) .width(200)
.backgroundColor(Color.Pink) .height(160)
} }
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column(){ Column() {
Text("Text") Text("Test ContextMenu")
}.bindContextMenu(this.MenuBuilder, ResponseType.LongPress) .fontSize(20)
.width('100%')
.height(500)
.backgroundColor(0xAFEEEE)
.textAlign(TextAlign.Center)
}
.bindContextMenu(this.MenuBuilder, ResponseType.LongPress)
.onDragStart(() => {
// 拖拽时关闭菜单
ContextMenu.close()
})
} }
.width('100%') .width('100%')
.height('100%') .height('100%')
} }
} }
``` ```
![contextmenu_close.gif](figures/contextmenu_close.gif)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册