From a331ceb3fb8a0419dd26888b22f05fc6bd11819d Mon Sep 17 00:00:00 2001 From: The shy <2048194618@qq.com> Date: Wed, 6 Dec 2023 02:46:58 +0000 Subject: [PATCH] =?UTF-8?q?update=20zh-cn/application-dev/reference/arkui-?= =?UTF-8?q?ts/ts-composite-components-selecttitlebar.md.=20=E9=AB=98?= =?UTF-8?q?=E7=BA=A7=E7=BB=84=E4=BB=B6=E7=BC=96=E8=AF=91=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: The shy <2048194618@qq.com> --- .../ts-composite-components-selecttitlebar.md | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-selecttitlebar.md b/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-selecttitlebar.md index 409914be5da..15f9d83d029 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-selecttitlebar.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-selecttitlebar.md @@ -61,28 +61,27 @@ SelectTitleBar({selected: number, options: Array<SelectOption>, menuItems? import { SelectTitleBar } from "@ohos.arkui.advanced.SelectTitleBar" import promptAction from '@ohos.promptAction' +class menuItem { + value: Resource; + isEnabled: boolean; + action?: () => void + + constructor(value: Resource,isEnabled: boolean,action?: () => void) { + this.value = value + this.isEnabled = isEnabled + this.action = action + } +} + @Entry @Component struct Index { - menuItems: { - value: Resource, - isEnabled: boolean, - action: () => void - }[] = - [ - { isEnabled: true, value: $r('app.media.ic_public_save'), - action: () => promptAction.showToast({ message: "show toast index 1" }) - }, - { isEnabled: true, value: $r('app.media.ic_public_reduce'), - action: () => promptAction.showToast({ message: "show toast index 2" }) - }, - { isEnabled: true, value: $r('app.media.ic_public_edit'), - action: () => promptAction.showToast({ message: "show toast index 3" }) - }, - { isEnabled: true, value: $r('app.media.ic_public_reduce'), - action: () => promptAction.showToast({ message: "show toast index 4" }) - } - ] + private menuItems:Array =[ + new menuItem($r('app.media.ic_public_save'),true,() => promptAction.showToast({ message: "show toast index 1" })), + new menuItem($r('app.media.ic_public_reduce'),true,() => promptAction.showToast({ message: "show toast index 2" })), + new menuItem($r('app.media.ic_public_edit'),true,() => promptAction.showToast({ message: "show toast index 3" })), + new menuItem($r('app.media.ic_public_reduce'),true,() => promptAction.showToast({ message: "show toast index 4" })) + ] build() { Row() { -- Gitee