当前位置:网站首页>Quick app bottom navigation bar
Quick app bottom navigation bar
2022-04-23 05:25:00 【Courtesy.】


The code is as follows :
<template>
<div class="wrapper">
<!-- tab Navigation -->
<div class="fix-bar">
<!-- home page -->
<div class="bar index" @click="tabClick('Index')">
<image
class="img"
src="/assets/img/shouye{
{numIndex}}.png"
style="object-fit: contain"
></image>
<text class="text-index"> home page </text>
</div>
<!-- news -->
<div class="bar setting" @click="tabClick('News')">
<image
class="img"
src="/assets/img/news{
{numNews}}.png"
style="object-fit: contain"
></image>
<text class="text-index"> information </text>
</div>
<!-- my -->
<div class="bar setting" @click="tabClick('Mine')">
<image
class="img"
src="/assets/img/wode{
{numMine}}.png"
style="object-fit: contain"
></image>
<text class="text-index"> my </text>
</div>
</div>
</div>
</template>
<script>
import router from '@system.router'
export default {
data: {
numIndex: 1,
numNews: 0,
numMine: 0,
},
onInit() {
let pageName = this.$page.currentPageName || this.$page.name
if (pageName === "pages/Index") {
this.numIndex = 1
this.numMine = 0
this.numNews = 0
} else if (pageName === "pages/News") {
this.numIndex = 0
this.numMine = 0
this.numNews = 1
} else if (pageName === "pages/Mine" || pageName === "pages/Setting" || pageName === "pages/Login") {
this.numIndex = 0
this.numMine = 1
this.numNews = 0
}
},
tabClick(type) {
router.replace({
uri: "pages/" + type
})
}
}
</script>
<style lang="less">
.wrapper {
width: 100%;
display: flex;
flex-flow: row wrap;
flex-direction: column; /* Arrange vertically */
background: linear-gradient(
to right,
rgb(156, 203, 241) 500px,
rgb(254, 255, 255) 99%
);
.fix-bar {
height: 100px;
position: fixed;
bottom: 0px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background-color: #ffffff;
border-top: 1px solid #ccc;
.bar {
width: 33%;
justify-content: center;
flex-direction: column;
align-items: center;
}
.img {
width: 32px;
height: 32px;
}
.text-index {
color: rgba(54, 54, 54, 1);
font-size: 20px;
}
}
}
</style>
版权声明
本文为[Courtesy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544339408.html
边栏推荐
猜你喜欢

Laravel implements the Holy Grail model with template inheritance

2021-09-28

Domain driven model DDD (III) -- using saga to manage transactions

Devops life cycle, all you want to know is here!

Camera imaging + homography transformation + camera calibration + stereo correction

Requirements for SQL server to retrieve SQL and user information

varnish入门

When is it appropriate for automated testing? (bottom)

selenium預先加載cookie的必要性

SQL Server检索SQL和用户信息的需求
随机推荐
JVM memory and memory overflow exceptions (personal summary)
日志简介和构建web应用
mariadb数据库的主从复制
Use of ES6 array
Error handling mechanism of the strongest egg framework in history
egg中的cors和proxy(づ ̄3 ̄)づ╭~踩坑填坑的过程~ToT~
2021-10-12
青岛敏捷之旅,来了!
[untitled] kimpei kdboxpro's cool running lantern coexists with beauty and strength
WTL self drawn control library (cqscheckcomboxbox)
引入精益管理方式,需要提前做到这九点
好的测试数据管理,到底要怎么做?
SQL Server检索SQL和用户信息的需求
2021-10-08
Low code and no code considerations
String class understanding - final is immutable
4 most common automated test challenges and Countermeasures
d.ts---更详细的知识还是需要看官网的介绍(声明文件章节)
CPT 104_TTL 09
Semi synchronous replication of MariaDB