From e1b982815bb4548ddc52c4bbb8b995705e0bce7a Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Mon, 18 Aug 2025 11:32:05 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=AD=A6=E5=91=8A=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- README.md | 2 +- entry/src/main/ets/view/ProductList.ets | 11 ++++++++--- entry/src/main/module.json5 | 4 +--- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.en.md b/README.en.md index 59a6171..96391e2 100644 --- a/README.en.md +++ b/README.en.md @@ -30,7 +30,7 @@ componentstack │ │ └──ProductList.ets // Custom component of the product list │ └──viewmodel │ ├──DataSource.ets // List data model -│ └──IconModel.ets // Data type definition +│ └──IconViewModel.ets // Data type definition └────entry/src/main/resources ``` diff --git a/README.md b/README.md index 6da96a8..b51c7d4 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ componentstack │ │ └──ProductList.ets // 商品列表自定义组件 │ └──viewmodel │ ├──DataSource.ets // 列表数据模型 -│ └──IconModel.ets // 数据类型定义 +│ └──IconViewModel.ets // 数据类型定义 └────entry/src/main/resources ``` diff --git a/entry/src/main/ets/view/ProductList.ets b/entry/src/main/ets/view/ProductList.ets index 33e5d10..1057eeb 100644 --- a/entry/src/main/ets/view/ProductList.ets +++ b/entry/src/main/ets/view/ProductList.ets @@ -13,7 +13,6 @@ * limitations under the License. */ -import { promptAction } from '@kit.ArkUI'; import { PRODUCT_DATA } from '../model/IconModel'; import { ProductDataModel } from '../viewmodel/IconViewModel'; import { ProductDataSource } from '../viewmodel/DataSource'; @@ -73,8 +72,14 @@ export struct ProductList { .height($r('app.integer.water_flow_column_height')) .backgroundColor(Color.White) .borderRadius($r('app.integer.water_flow_column_border_radius')) - .onClick(()=>{ - this.getUIContext().getPromptAction().showToast({ message: $r('app.string.component_stack_other_function')}); + .onClick(() => { + try { + this.getUIContext() + .getPromptAction() + .showToast({ message: $r('app.string.component_stack_other_function') }); + } catch (error) { + console.error(`showToast args error code is ${error.code}, message is ${error.message}`); + } }); } }, (item: ProductDataModel) => item.id.toString()) diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index de78b5c..5f6f8e1 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -5,9 +5,7 @@ "description": "$string:module_desc", "mainElement": "EntryAbility", "deviceTypes": [ - "phone", - "tablet", - "2in1" + "phone" ], "deliveryWithInstall": true, "installationFree": false, -- Gitee