vue+el-table 路由跳转及返回

让table每行都可以实现跳转,给table绑定点击事件

<el-table :data="tableDataCb" style="width: 100%" @row-click="openDialog">
              <el-table-column
                  prop="W_NAME"
                  label="名称"
                  align="center"
              ></el-table-column>
  </el-table>

在methods里面添加方法,此时的跳转页面需要是加载在router里面的

openDialog() {
      this.$router.push({path: '/EnvAnalysis/DataWindow'})
  }

跳回上一级路由

goback() {
      this.$router.go(-1)
  }

 

  注意:$route为当前router跳转对象里面可以获取name、path、query、params等;$router为VueRouter实例,想要导航到不同URL,则使用$router.push方法

posted @ 2019-08-21 09:40  甜甜的小可爱ha  阅读(2527)  评论(0编辑  收藏  举报