<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # 路由的其它配置 ## 命名視圖 有時候想同時 (同級) 展示多個視圖,而不是嵌套展示,**例如創建一個布局**,有`sidebar`(側導航) 和`main`(主內容) 兩個視圖,這個時候命名視圖就派上用場了。你可以在界面中擁有多個單獨命名的視圖,而不是只有一個單獨的出口。如果`router-view`沒有設置名字,那么默認為`default`。 ``` <router-view class="view one"></router-view> <router-view class="view two" name="a"></router-view> <router-view class="view three" name="b"></router-view> ``` ``` const router = new VueRouter({ routes: [ { path: '/', components: { default: Foo, a: Bar, b: Baz } } ] }) ``` ## 案例 移動端`tabbar` 底欄,有一些頁面是不需要顯示的。只有對應的這五個頁面是需要顯示`tabbar`底欄的,如何完成? ![](https://img.kancloud.cn/b2/af/b2af44b2c2e774a888817c999b0f37e9_396x677.gif) ## 思考 可以將網頁分成兩部分,上面一部分是網頁的核心 ,那么`router-view`只顯示網頁核心 ;下面一部分是網頁的底欄,那么`router-view`只顯示網頁的底欄。`router-view` 組件默認是不會區分上部和下部的。這就需要使用命名視圖。 ![](https://img.kancloud.cn/d9/12/d9126b45d28d8fd89db06f9c0de5f8da_734x720.png) ## tabbar組件實現 >[success] 樣式使用`less`,默認是`css`,需要對`style`標簽添加`lang="less"` 。需要我們安裝less-loader 和less不然會報錯 > 如下 ``` /src/components/Tabbar.vue Module not found: Error: Can't resolve 'less-loader' in 'C:\Users\zhaoy\Desktop\myvuex' ``` ### **Tabbar組件,簡易版(組件可以直接復制使用,不用書寫)** ``` <template> <ul class="footer"> <li> <router-link to="/home"> <i class="iconfont icon-home"></i> <p>首頁</p> </router-link> </li> <li> <router-link to="/cate"> <i class="iconfont icon-fenlei"></i> <p>分類</p> </router-link> </li> <li> <router-link to="/pingou"> <i class="iconfont icon-pingou"></i> <p>拼購</p> </router-link> </li> <li> <router-link to="/cart"> <i class="iconfont icon-gouwuche"></i> <p>購物車</p> </router-link> </li> <li> <router-link to="/user"> <i class="iconfont icon-yonghu"></i> <p>未登錄</p> </router-link> </li> </ul> </template> <script> export default { name: "Tabbar" } </script> <style scoped lang="less"> .footer { z-index: 99; width: 100%; height: 44px; position: fixed; left: 0; bottom: 0; background: #ffffff; display: flex; li { width: 20%; height: 100%; a { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; align-content: center; &.active { color: #F23030; } } } .iconfont { font-size: 20px; } p { font-size: 12px; transform: scale(0.85, 0.85); } } </style> ``` ## APP組件修改 ``` <template> <div id="app"> <router-view></router-view> <router-view name="tabbar"></router-view> </div> </template> <script> import './assets/css/reset.css'; export default { name: 'app', } </script> <style> </style> ``` ## 路由修改 ``` var router = new VueRouter({ routes: [ {path: '/home', components: {default: Home, tabbar: Tabbar}}, {path: '/cate', components: {default: Category, tabbar: Tabbar}}, {path: '/pingou', components: {default: Purchase, tabbar: Tabbar}}, {path: '/cart', components: {default: Cart, tabbar: Tabbar}}, {path: '/user', components: {default: User, tabbar: Tabbar}}, {path: '/about', component: About}, {path: '*', component: Error404} ], linkActiveClass:'active', linkExactActiveClass:'exact-active' }); ``` ## 圖示 ![](https://img.kancloud.cn/99/3d/993d28597bdc0fcbd6a61731c0bc6add_1920x571.png) ## 效果 ![](https://img.kancloud.cn/82/25/82258dfb9136b94b0a5f9794867c27de_418x685.gif)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看