Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
2b3396de
Commit
2b3396de
authored
Jun 16, 2025
by
张九刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 Home 组件的状态管理,修复 setHomeInfo 方法中的逻辑顺序,并在 Home.vue 中添加对 homeInfo 的监控,确保初始化信息的正确加载
parent
b5b7aa20
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
home.js
stores/home.js
+2
-1
Home.vue
views/Home.vue
+7
-7
No files found.
stores/home.js
View file @
2b3396de
...
@@ -21,12 +21,13 @@ export const useHomeStore = defineStore('homeInfo', {
...
@@ -21,12 +21,13 @@ export const useHomeStore = defineStore('homeInfo', {
* @param {Object} homeInfo
* @param {Object} homeInfo
*/
*/
setHomeInfo
(
homeInfo
)
{
setHomeInfo
(
homeInfo
)
{
this
.
homeInfo
=
homeInfo
;
if
(
homeInfo
?.
memberId
===
"not_login"
){
if
(
homeInfo
?.
memberId
===
"not_login"
){
this
.
isLogin
=
false
;
this
.
isLogin
=
false
;
}
else
{
}
else
{
this
.
isLogin
=
true
;
this
.
isLogin
=
true
;
}
}
this
.
homeInfo
=
homeInfo
;
},
},
setBabyExistence
(
babyExistence
){
setBabyExistence
(
babyExistence
){
console
.
log
(
'setBabyExistence'
,
babyExistence
);
console
.
log
(
'setBabyExistence'
,
babyExistence
);
...
...
views/Home.vue
View file @
2b3396de
...
@@ -191,12 +191,16 @@ export default {
...
@@ -191,12 +191,16 @@ export default {
this
.
statusBarHeight
=
menuButtonInfo
.
top
;
this
.
statusBarHeight
=
menuButtonInfo
.
top
;
this
.
isClickPhoneAuth
=
false
;
this
.
isClickPhoneAuth
=
false
;
this
.
initHomeInfo
();
},
},
watch
:
{
watch
:
{
homeStore
:{
homeStore
:{
handler
(
newVal
){
handler
(
newVal
){
this
.
showRegisterLayer
=
this
.
isClickPhoneAuth
&&
newVal
.
isLogin
&&
!
newVal
.
babyExistence
;
this
.
showRegisterLayer
=
this
.
isClickPhoneAuth
&&
newVal
.
isLogin
&&
!
newVal
.
babyExistence
;
console
.
log
(
'newVal.homeInfo'
,
newVal
.
homeInfo
);
if
(
newVal
.
homeInfo
!==
null
){
this
.
initHomeInfo
();
}
},
},
deep
:
true
,
deep
:
true
,
immediate
:
true
immediate
:
true
...
@@ -204,14 +208,10 @@ export default {
...
@@ -204,14 +208,10 @@ export default {
},
},
methods
:
{
methods
:
{
async
initHomeInfo
()
{
async
initHomeInfo
()
{
// try{
// await this.homeStore.loadHomeInfo();
// }catch(e){
// console.log('loadHomeInfo error',e);
// }
const
{
data
}
=
await
fetchHomeJSON
();
const
{
data
}
=
await
fetchHomeJSON
();
console
.
log
(
'111111111111'
,
data
);
if
(
data
)
{
if
(
data
)
{
this
.
swiperList
=
data
.
swiperList
;
this
.
swiperList
=
data
.
swiperList
;
this
.
vipConfigList
=
data
.
vipConfigList
;
this
.
vipConfigList
=
data
.
vipConfigList
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment