zoukankan      html  css  js  c++  java
  • vue代码总结—tabbar搭建

    tabbar搭建

    App.vue

    <template>
      <div id="app">
        <!-- 路由出口!!!!! -->
        <router-view></router-view>
        <van-tabbar v-model="active">
          <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
          <van-tabbar-item icon="orders-o" to="/order">订单</van-tabbar-item>
          <van-tabbar-item icon="friends-o" to="/mine">我的</van-tabbar-item>
        </van-tabbar>
      </div>
    </template>
    
    <script>
    import Home from "./components/Home.vue";
    import { Tabbar, TabbarItem } from "vant";
    export default {
      name: "app",
      data(){
        return {
          active: 0
        }
      },
      components: {
        [Home.name]: Home,
        [Tabbar.name]: Tabbar,
        [TabbarItem.name]: TabbarItem,
      },
    };
    </script>
    
    <style lang='scss'>
    @import "style/init.css";
    .van-search {
      padding: 0;
    }
    </style>

    routes.js

    /* jshint esversion: 6 */
    import VueRouter from "vue-router";
    import Vue from 'vue';
    import Order from '@/components/Order';
    import Home from '@/components/Home';
    import My from '@/components/My';
    
    Vue.use(VueRouter);
    
    const routes = [
        {
            path: '/',
            component:Home,
            name: 'home'
        },
        {
            path: '/order',
            component:Order,
            name: 'order'
        },
        {
            path: '/mine',
            component:My,
            name: 'mine'
        },
    ];
    
    // 添加mode为history就不会有#
    const router = new VueRouter({
        mode: 'history',
        routes
    });
    
    export default router;

    main.js

    new Vue({
      render: h => h(App),
      router
    }).$mount('#app');

    实现效果图

     

     

     

    你的无畏来源于你的无知!

  • 相关阅读:
    峰Spring4学习(1)HelloWorld
    小峰mybatis(5)mybatis使用注解配置sql映射器--动态sql
    前端实现某一列不能重复不能且不能为空
    jquery:给正则表达式添加变量
    css:width height
    让heigh:100%起作用
    jquery:选择器 过滤器
    vs:如何添加.dll文件
    jq:正则表达式
    css:html() text() val()
  • 原文地址:https://www.cnblogs.com/YiwenGG/p/13869443.html
Copyright © 2011-2022 走看看