From bf8960cb929cc19c874836518a57b22b65b671cb Mon Sep 17 00:00:00 2001 From: The shy <2048194618@qq.com> Date: Wed, 6 Dec 2023 08:38:09 +0000 Subject: [PATCH] =?UTF-8?q?update=20zh-cn/application-dev/reference/arkui-?= =?UTF-8?q?ts/ts-composite-components-composetitlebar.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-composetitlebar.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-composetitlebar.md b/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-composetitlebar.md index d4f5bb93333..06df2cf9428 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-composetitlebar.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-composite-components-composetitlebar.md @@ -59,26 +59,26 @@ ComposeTitleBar({item?: ComposeTitleBarMenuItem, title: ResourceStr, subtitle?: import { ComposeTitleBar } from "@ohos.arkui.advanced.ComposeTitleBar" 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.icon'),true,() => promptAction.showToast({ message: "show toast index 1" })), + new menuItem($r('app.media.icon'),true,() => promptAction.showToast({ message: "show toast index 2" })), + new menuItem($r('app.media.icon'),true,() => promptAction.showToast({ message: "show toast index 3" })), + new menuItem($r('app.media.icon'),true,() => promptAction.showToast({ message: "show toast index 4" })) ] build() { -- Gitee