diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..e39ffaab51097515a49f19bef1390ea5c109bc1b --- /dev/null +++ b/README.en.md @@ -0,0 +1,32 @@ +# To-Do List + +## Introduction + +This codelab introduces how to implement a simple to-do list based on the ArkTS declarative syntax and basic components. Example: + +![](screenshots/device/ToDoList.en.gif) + +## Concepts + +- ArkTS: the most popular programming language for HarmonyOS apps. ArkTS is a superset of TypeScript (TS). + +- Text: a component that is used to display a piece of text. + +- Column: a container that arranges components vertically. + +- Row: a container that arranges components horizontally. + +## Permissions + +N/A + +## How to Use + +1. Open the app home page, tap an item in the to-do list, and mark the item as completed. + +## Constraints + +1. The sample is only supported on Huawei phones with standard systems. +2. HarmonyOS: HarmonyOS NEXT Developer Beta1 or later. +3. DevEco Studio: DevEco Studio NEXT Developer Beta1 or later. +4. HarmonyOS SDK: HarmonyOS NEXT Developer Beta1 SDK or later. diff --git a/README.md b/README.md index 247a98cd7b867b08b3b775b4a1c99c04b94eda4d..3c6b842c890d76ee97cb2494c491de9623f88b15 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# UI框架-待办列表 +# 待办列表 ## 简介 diff --git a/entry/src/main/ets/common/constant/CommonConstant.ets b/entry/src/main/ets/common/constant/CommonConstant.ets index 50dd0cdbd4015f390caa241e8a06a6d5d8486f0b..881a81b67dfb8365d755ed874f6e44f3ebe733dc 100644 --- a/entry/src/main/ets/common/constant/CommonConstant.ets +++ b/entry/src/main/ets/common/constant/CommonConstant.ets @@ -60,12 +60,12 @@ export default class CommonConstants { /** * agents data. */ - static readonly TODO_DATA: Array = [ - "早起晨练", - "准备早餐", - "阅读名著", - "学习ArkTS", - "看剧放松" + static readonly TODO_DATA: Array = [ + $r('app.string.todo_list_one'), + $r('app.string.todo_list_two'), + $r('app.string.todo_list_three'), + $r('app.string.todo_list_four'), + $r('app.string.todo_list_five') ]; } diff --git a/entry/src/main/ets/pages/ToDoListPage.ets b/entry/src/main/ets/pages/ToDoListPage.ets index 3c1be2538a6f0d6b751daf21a8898715dbe12187..452a32195c80200650266f4df5edee7d5defdee9 100644 --- a/entry/src/main/ets/pages/ToDoListPage.ets +++ b/entry/src/main/ets/pages/ToDoListPage.ets @@ -20,7 +20,7 @@ import ToDoItem from '../view/ToDoItem'; @Entry @Component struct ToDoListPage { - private totalTasks: Array = []; + private totalTasks: Array = []; aboutToAppear() { this.totalTasks = DataModel.getData(); diff --git a/entry/src/main/ets/viewmodel/DataModel.ets b/entry/src/main/ets/viewmodel/DataModel.ets index 381503c09e846e5470dbf529d6f6ee1f63313fbb..6d205dc51f7168a4bb03eaab424b8a7d30e74236 100644 --- a/entry/src/main/ets/viewmodel/DataModel.ets +++ b/entry/src/main/ets/viewmodel/DataModel.ets @@ -22,12 +22,12 @@ export class DataModel { /** * Saved Data. */ - private tasks: Array = CommonConstants.TODO_DATA; + private tasks: Array = CommonConstants.TODO_DATA; /** * Get the data. */ - getData(): Array { + getData(): Array { return this.tasks; } } diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 9d4c23bec1fd8219a4aeb2502d6d0be9a0b6b4b7..9427a881e4754349c94547905e1283c92917926b 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -10,11 +10,31 @@ }, { "name": "EntryAbility_label", - "value": "待办列表" + "value": "ToDoList" }, { "name": "page_title", - "value": "待办" + "value": "ToDo" + }, + { + "name": "todo_list_one", + "value": "Early Exercise" + }, + { + "name": "todo_list_two", + "value": "Prepare Breakfast" + }, + { + "name": "todo_list_three", + "value": "Read Classics" + }, + { + "name": "todo_list_four", + "value": "Learn ArkTS" + }, + { + "name": "todo_list_five", + "value": "Relax With TV Show" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index d28650e927a9ea7722166e236a2b9af65ebe0e5e..9427a881e4754349c94547905e1283c92917926b 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -15,6 +15,26 @@ { "name": "page_title", "value": "ToDo" + }, + { + "name": "todo_list_one", + "value": "Early Exercise" + }, + { + "name": "todo_list_two", + "value": "Prepare Breakfast" + }, + { + "name": "todo_list_three", + "value": "Read Classics" + }, + { + "name": "todo_list_four", + "value": "Learn ArkTS" + }, + { + "name": "todo_list_five", + "value": "Relax With TV Show" } ] } \ No newline at end of file diff --git a/entry/src/main/resources/zh_CN/element/string.json b/entry/src/main/resources/zh_CN/element/string.json index abe870adc685f84e249a7d382754e3579f18711f..80f44ff09e35e0e7a063f7afb8f52e255deac7c0 100644 --- a/entry/src/main/resources/zh_CN/element/string.json +++ b/entry/src/main/resources/zh_CN/element/string.json @@ -15,6 +15,26 @@ { "name": "page_title", "value": "待办" + }, + { + "name": "todo_list_one", + "value": "早起晨练" + }, + { + "name": "todo_list_two", + "value": "准备早餐" + }, + { + "name": "todo_list_three", + "value": "阅读名著" + }, + { + "name": "todo_list_four", + "value": "学习ArkTS" + }, + { + "name": "todo_list_five", + "value": "看剧放松" } ] } \ No newline at end of file diff --git a/screenshots/device/ToDoList.en.gif b/screenshots/device/ToDoList.en.gif new file mode 100644 index 0000000000000000000000000000000000000000..4c1b62824f93d76cc0b86be9b82c6346ebe871da Binary files /dev/null and b/screenshots/device/ToDoList.en.gif differ