diff --git a/README.en.md b/README.en.md index 59a6171951fa7a0318f18c9839d3c6a002d8bb7e..96391e282cb66270ee03547d11adfaaf0163fc77 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 6da96a82dc986d0b6bb887705b58adff93af9a82..b51c7d42f0e6999897777132faf7a12e3bbb2ac4 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 33e5d1016c46dd681e2a6ef00a10265f77fc0dd8..1057eeb944ec3866ecbfb7710568b35997cd562e 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 de78b5cae3b2ba99788048311e5d0cd34d075039..5f6f8e183e9195d8178183502bf018e80c02f9a1 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,