最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

利用vant如何給tabbar配置路由

 更新時(shí)間:2022年04月28日 08:48:21   作者:Simple_IDE  
這篇文章主要介紹了利用vant如何給tabbar配置路由,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

給tabbar配置路由

在父級(jí)路由寫tabbar標(biāo)簽

<template>
<div class="layoutContainer">
? ? <!-- 子路由出口 -->
? ? <router-view></router-view>
? ? <!-- 底部導(dǎo)航欄 -->
? ? <!-- 給tabbar--route屬性 ?然后給每一項(xiàng)to屬性就可以路由跳轉(zhuǎn)了 -->
? ? <van-tabbar v-model="active" route>
? ? ? ? <van-tabbar-item icon="home-o" to="/">首頁(yè)</van-tabbar-item>
? ? ? ? <van-tabbar-item icon="search" to="/question">問(wèn)答</van-tabbar-item>
? ? ? ? <van-tabbar-item icon="friends-o" to="/video">視頻</van-tabbar-item>
? ? ? ? <van-tabbar-item icon="setting-o" to="/my">我的</van-tabbar-item>
? ? </van-tabbar>
</div>
</template>
<script>
export default {
? ? name: 'layoutIndex',
? ? data() {
? ? ? ? return {
? ? ? ? ? ? active: 0
? ? ? ? }
? ? }
}
</script>
<style>
#app {
? ? font-family: Avenir, Helvetica, Arial, sans-serif;
? ? -webkit-font-smoothing: antialiased;
? ? -moz-osx-font-smoothing: grayscale;
? ? text-align: center;
? ? color: #2c3e50;
}
</style>

在路由配置的JavaScript文件中

import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
//路由表
const routes = [
? {
? ? path:'/login',
? ? name:'login',
? ? component:()=>import('@/views/login/')
? },
? {
? ? path:'/',
? ? component:()=>import('@/views/layout/'),
? ? children:[
? ? ? {
? ? ? ? path:'',//首頁(yè)是默認(rèn)子路由,所謂為空
? ? ? ? name:'home',
? ? ? ? component:()=>import('@/views/home/')
? ? ? },
? ? ? {
? ? ? ? path:'/question',
? ? ? ? name:'question',
? ? ? ? component:()=>import('@/views/question/')
? ? ? },
? ? ? {
? ? ? ? path:'/video',
? ? ? ? name:'video',
? ? ? ? component:()=>import('@/views/video/')
? ? ? },
? ? ? {
? ? ? ? path:'/my',
? ? ? ? name:'my',
? ? ? ? component:()=>import('@/views/my/')
? ? ? }
? ? ]
? }
]
const router = new VueRouter({
? routes
})
export default router

vant踩坑記錄

tabbbar路由模式

<router-view />
<van-tabbar route>
? <van-tabbar-item replace to="/home/menu/資源" icon="home-o">標(biāo)簽</van-tabbar-item>
? ? <van-tabbar-item replace to="/home/menu/信息" icon="home-o">標(biāo)簽</van-tabbar-item>
? <van-tabbar-item replace to="/search" icon="search">標(biāo)簽</van-tabbar-item>
</van-tabbar>

這里使用路由傳參

二級(jí)路由跳轉(zhuǎn)到子級(jí)頁(yè)面,返回以后,tabbar按鈕高亮消失,原因是傳遞的參數(shù)不能是漢字,改為英文就好了

<router-view />
<van-tabbar route>
? <van-tabbar-item replace to="/home/menu/resources" icon="home-o">標(biāo)簽</van-tabbar-item>
? ? <van-tabbar-item replace to="/home/menu/information" icon="home-o">標(biāo)簽</van-tabbar-item>
? <van-tabbar-item replace to="/search" icon="search">標(biāo)簽</van-tabbar-item>
</van-tabbar>

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

南皮县| 扶余县| 营口市| 龙州县| 斗六市| 库伦旗| 海晏县| 汶上县| 扬中市| 镇原县| 朝阳市| 利川市| 普格县| 隆化县| 云和县| 南京市| 孝感市| 和硕县| 晋江市| 清镇市| 金沙县| 淳化县| 页游| 松江区| 江源县| 兴和县| 塘沽区| 九台市| 清原| 嘉义市| 吉首市| 华容县| 齐齐哈尔市| 无锡市| 吉木乃县| 方山县| 博客| 定日县| 栾川县| 临西县| 永新县|