Vue2.0+ElementUI router页面跳转子路径问题

javascript 复制代码
<template>
  <div class="bottom-navbar">
    
    <el-row :gutter="32">
      <el-col :xs="8" :sm="8" :lg="8">
        <div class="bottom-button" @click="showWorkbench">
            <i class="el-icon-s-home" style="color:#fff;" />
            <div>
                <a class="bottom-button-text">工作台</a>
            </div>
        </div>
      </el-col>
      
      <el-col :xs="8" :sm="8" :lg="8">
        <div class="bottom-button" @click="showStatistics">
            <i class="el-icon-s-data" style="color:#fff;" />
            <div>
                <a class="bottom-button-text">统计</a>
            </div>
        </div>
      </el-col>

      <el-col :xs="8" :sm="8" :lg="8">
        <div class="bottom-button" @click="showDiscover">
            <i class="el-icon-discover" style="color:#fff;" />
            <div>
                <a class="bottom-button-text">发现</a>
            </div>
        </div>
      </el-col>

    </el-row>

  </div>
</template>

<script>
export default {
  name: 'BottomPanel',
  data() {
    return {
      show: false
    }
  },
  computed: {
    theme() {
      return this.$store.state.settings.theme
    }
  },
  watch: {
  },
  mounted() {
  },
  beforeDestroy() {
  },
  methods: {
    //工作台
    showWorkbench(){
      // this.$router.push('/');
      this.$router.push('/dashboard1');
    },
    //统计
    showStatistics(){
      // this.$router.push('/dashboard');
      this.$router.push('/admin/statistics');
    },
    //发现
    showDiscover(){
      // this.$router.push('/documentation');
      this.$router.push('/admin/discover');
    },
  }
}
</script>

<style lang="scss" scoped>
  .bottom-navbar{
    position:fixed;
    bottom: 0;
    width: 100%;
    height: 50px;
    background-color: #304156;
  }

  .bottom-button{
    background-color: rgba(0, 0, 0, .05); 
    width: 30%;
    height: 100%;
    margin: 8px auto; 
    text-align: center;
  }

.bottom-button-text{
  color: #fff;
  outline: none;//去除外轮廓,outline:none;表示使outline属性无效,使绘制于元素周围的一条线无效。
  font-size: 12px;
}

.bottom-button:hover{
  .bottom-button-text,i{
    color: #36a3f7 !important;
  }
}


</style>
javascript 复制代码
  {
    path: '/',//主页路径
    component: Layout,
    redirect: '/dashboard1',
    children: [
      {
        path: 'dashboard1',
        component: () => import('@/views/dashboard-black/index'),
        name: 'Dashboard1',
        meta: { title: '数据看板', icon: 'dashboard', affix: true }
      }
    ]
  },
  {
    path: '/admin/statistics',
    component: Layout,
    redirect: {name :'statistics'},
    children: [
      {
        path: 'statistics',
        component: () => import('@/views/dashboard-black/admin/statistics'),
        name: 'statistics',
        meta: { title: '统计', icon: 'chart', affix: true }
      }
    ]
  },
  {
    path: '/admin/discover',
    component: Layout,
    redirect: {name :'discover'},
    children: [
      {
        path: 'discover',
        component: () => import('@/views/dashboard-black/admin/discover'),
        name: 'discover',
        meta: { title: '发现', icon: 'nested', affix: true }
      }
    ]
  },
相关推荐
海天胜景24 分钟前
jqGrid冻结列错行问题,将冻结表格(悬浮表格)与 正常表格进行高度同步
前端
清风细雨_林木木1 小时前
解决 Tailwind CSS 代码冗余问题
前端·css
HSunR1 小时前
vue3 elementplus tabs切换实现
javascript·vue.js·elementui
搏博1 小时前
WPS中代码段的识别方法及JS宏实现
开发语言·javascript·wps
三天不学习1 小时前
VueUse/Core:提升Vue开发效率的实用工具库
前端·javascript·vue.js·vueuse
好青崧1 小时前
等于和绝对等于的区别
javascript
余道各努力,千里自同风2 小时前
CSS实现文本自动平衡text-wrap: balance
前端·css
半青年2 小时前
Qt图表库推荐指南与分析
c语言·开发语言·javascript·c++·qt·信息可视化
Yvonne爱编码2 小时前
CSS- 4.3 绝对定位(position: absolute)&学校官网导航栏实例
前端·css·html·html5·hbuilder
繁依Fanyi3 小时前
ImgShrink:摄影暗房里的在线图片压缩工具开发记
开发语言·前端·codebuddy首席试玩官