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

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

<el-table :data="tableDataCb"  @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方法