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

讓table每行均可以實現跳轉,給table綁定點擊事件this

<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裏面的spa

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

跳回上一級路由

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

 

  注意:$route爲當前router跳轉對象裏面能夠獲取name、path、query、params等;$router爲VueRouter實例,想要導航到不一樣URL,則使用$router.push方法code

相關文章
相關標籤/搜索