feat:tabbar 底部栏

master
ewall 5 years ago
parent 6c08fe56f2
commit ccfe2f643d

@ -1,5 +1,15 @@
<template> <template>
<div id="app"> <div id="app">
<router-view /> <router-view />
<tabbar />
</div> </div>
</template> </template>
<script>
import Tabbar from './components/Tabbar'
export default {
components: {
Tabbar
}
}
</script>

@ -0,0 +1,44 @@
<template>
<div>
<div class="tabbar">
<van-tabbar v-model="active" :active-color="variables.theme" :fixed="false">
<van-tabbar-item icon="wap-home">首页</van-tabbar-item>
<van-tabbar-item icon="bars">分类</van-tabbar-item>
<van-tabbar-item icon="shopping-cart">购物车</van-tabbar-item>
<van-tabbar-item icon="manager">我的</van-tabbar-item>
</van-tabbar>
</div>
<div class="tabbar--placeholder"></div>
</div>
</template>
<script>
import variables from '@/styles/variables.scss'
export default {
data() {
return {
active: 0
}
},
computed: {
variables() {
return variables
}
}
}
</script>
<style lang="scss" scoped>
.tabbar {
width: 100vw;
position: fixed;
bottom: 0;
left: 0;
border-top: 2px solid #f5f5f5;
}
.tabbar--placeholder {
width: 100vw;
height: 100px;
}
</style>

@ -18,7 +18,9 @@ import {
SwipeItem, SwipeItem,
Loading, Loading,
Tag, Tag,
CountDown CountDown,
Tabbar,
TabbarItem
} from 'vant' } from 'vant'
Vue.use(Toast) Vue.use(Toast)
@ -38,3 +40,5 @@ Vue.use(Toast)
.use(Loading) .use(Loading)
.use(Tag) .use(Tag)
.use(CountDown) .use(CountDown)
.use(Tabbar)
.use(TabbarItem)

Loading…
Cancel
Save