Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
ai-astro-app
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liubinyu
ai-astro-app
Commits
2936e8a4
Commit
2936e8a4
authored
Jun 05, 2025
by
liubinyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tabbar激活
parent
d2b39a3a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
tabbar.vue
components/tabbar/tabbar.vue
+17
-7
No files found.
components/tabbar/tabbar.vue
View file @
2936e8a4
<
template
>
<
template
>
<view
class=
"tabbar"
>
<view
class=
"tabbar"
>
<view
class=
"item"
@
click=
"go('/pages/home/home')"
>
<view
class=
"item"
:class=
"
{ active: page.indexOf('home') > -1 }"
@click="go('/pages/home/home')">
<image
class=
"icon"
src=
"@/static/icon-home.png"
mode=
"aspectFit"
></image>
<image
class=
"icon"
src=
"@/static/icon-home.png"
mode=
"aspectFit"
></image>
<view
class=
"name"
>
{{
$t
(
'Home'
)
}}
</view>
<view
class=
"name"
>
{{
$t
(
'Home'
)
}}
</view>
</view>
</view>
<view
class=
"item"
@
click=
"go('/pages/chat/chat')"
>
<view
class=
"item"
:class=
"
{ active: page.indexOf('chat') > -1 }"
@click="go('/pages/chat/chat')">
<image
class=
"icon"
src=
"@/static/icon-chat.png"
mode=
"aspectFit"
></image>
<image
class=
"icon"
src=
"@/static/icon-chat.png"
mode=
"aspectFit"
></image>
<view
class=
"name"
>
{{
$t
(
'Astrologer'
)
}}
</view>
<view
class=
"name"
>
{{
$t
(
'Astrologer'
)
}}
</view>
</view>
</view>
<view
class=
"item"
@
click=
"go('/pages/user/user')"
>
<view
class=
"item"
:class=
"
{ active: page.indexOf('user') > -1 }"
@click="go('/pages/user/user')">
<image
class=
"icon"
src=
"@/static/icon-user.png"
mode=
"aspectFit"
></image>
<image
class=
"icon"
src=
"@/static/icon-user.png"
mode=
"aspectFit"
></image>
<view
class=
"name"
>
{{
$t
(
'Profile'
)
}}
</view>
<view
class=
"name"
>
{{
$t
(
'Profile'
)
}}
</view>
</view>
</view>
...
@@ -19,16 +19,21 @@
...
@@ -19,16 +19,21 @@
export
default
{
export
default
{
name
:
"tabbar"
,
name
:
"tabbar"
,
data
()
{
data
()
{
return
{};
return
{
page
:
''
,
// 当前页面路径
active
:
''
,
// 激活按钮
};
},
},
beforeCreate
()
{
beforeCreate
()
{
uni
.
hideTabBar
();
uni
.
hideTabBar
();
},
},
created
()
{
const
pages
=
getCurrentPages
();
this
.
page
=
pages
[
pages
.
length
-
1
].
route
;
},
methods
:
{
methods
:
{
go
(
url
)
{
go
(
url
)
{
const
pages
=
getCurrentPages
();
if
(
url
.
indexOf
(
this
.
page
)
>
-
1
)
return
;
const
page
=
pages
[
pages
.
length
-
1
].
route
;
if
(
url
.
indexOf
(
page
)
>
-
1
)
return
;
uni
.
switchTab
({
url
})
uni
.
switchTab
({
url
})
},
},
},
},
...
@@ -56,6 +61,7 @@
...
@@ -56,6 +61,7 @@
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
gap
:
12rpx
;
gap
:
12rpx
;
opacity
:
0
.7
;
.icon
{
.icon
{
width
:
46rpx
;
width
:
46rpx
;
...
@@ -68,5 +74,9 @@
...
@@ -68,5 +74,9 @@
color
:
#FFFFFF
;
color
:
#FFFFFF
;
}
}
}
}
.item.active
{
opacity
:
1
;
}
}
}
</
style
>
</
style
>
\ No newline at end of file
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