Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MobileInternet Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobileInternetProject
MobileInternet Client
Commits
8754df8f
Commit
8754df8f
authored
2 months ago
by
yz
Browse files
Options
Downloads
Patches
Plain Diff
feat: todolist2
parent
6c4ac44d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entry/src/main/ets/pages/Index.ets
+1
-0
1 addition, 0 deletions
entry/src/main/ets/pages/Index.ets
entry/src/main/ets/pages/LocalPage.ets
+5
-5
5 additions, 5 deletions
entry/src/main/ets/pages/LocalPage.ets
with
6 additions
and
5 deletions
entry/src/main/ets/pages/Index.ets
+
1
−
0
View file @
8754df8f
...
@@ -46,6 +46,7 @@ struct Index {
...
@@ -46,6 +46,7 @@ struct Index {
LocalPage({state:this.state, totalTasks:this.totalTasks})
LocalPage({state:this.state, totalTasks:this.totalTasks})
}
}
.onWillShow(async ()=>{
.onWillShow(async ()=>{
// 在显示之前,更新待办事项状态
if(webAPI.token == '') this.state = 0
if(webAPI.token == '') this.state = 0
else {
else {
this.totalTasks = await webAPI.getItems()
this.totalTasks = await webAPI.getItems()
...
...
This diff is collapsed.
Click to expand it.
entry/src/main/ets/pages/LocalPage.ets
+
5
−
5
View file @
8754df8f
...
@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel'
...
@@ -5,6 +5,7 @@ import TodoItemModel from '../viewmodel/TodoItemModel'
import AddItem from '../view/AddItem';
import AddItem from '../view/AddItem';
import ItemDetail from '../view/ItemDetail'
import ItemDetail from '../view/ItemDetail'
import { promptAction } from '@kit.ArkUI';
import { promptAction } from '@kit.ArkUI';
import webAPI from '../public/WebAPI';
@Component
@Component
export struct LocalPage {
export struct LocalPage {
...
@@ -51,8 +52,8 @@ export struct LocalPage {
...
@@ -51,8 +52,8 @@ export struct LocalPage {
promptAction.showToast({ message: '登录以添加事项' })
promptAction.showToast({ message: '登录以添加事项' })
return
return
}
}
this.LocalPageStack.pushDestination({name:"AddItem", onPop: ()=> {
this.LocalPageStack.pushDestination({name:"AddItem", onPop:
async
()=> {
//
this.totalTasks =
DataModel.getData() //返回时更新数据(应对添加数据的情况)
this.totalTasks =
await webAPI.getItems()
}})
}})
})
})
}
}
...
@@ -76,10 +77,9 @@ export struct LocalPage {
...
@@ -76,10 +77,9 @@ export struct LocalPage {
ForEach(this.totalTasks, (item: TodoItemModel, index: number) => {
ForEach(this.totalTasks, (item: TodoItemModel, index: number) => {
ToDoItem({totalTasks: $totalTasks, myIndex: index, myTask: item})
ToDoItem({totalTasks: $totalTasks, myIndex: index, myTask: item})
.onClick(() => { //点击进入详情页
.onClick(() => { //点击进入详情页
this.LocalPageStack.pushDestination({name: 'ItemDetail' + index, onPop: ()=> {
this.LocalPageStack.pushDestination({name: 'ItemDetail' + index, onPop:
async
()=> {
//
this.totalTasks =
DataModel.getData() //返回时更新数据(应对删除数据的情况)
this.totalTasks =
await webAPI.getItems()
}})
}})
// item.itemName = '1' //在这里的改变无法被子组件察觉,而且不会存储
})
})
}, (item:string) => JSON.stringify(item))
}, (item:string) => JSON.stringify(item))
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment