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方法

转自: https://www.cnblogs.com/keai/p/11386942.html

原文地址:https://www.cnblogs.com/sylys/p/12313827.html

时间: 2024-07-30 01:15:41

vue+el-table 路由跳转及返回的相关文章

解决vue单页路由跳转后scrollTop的问题

作为vue的初级使用者,在开发过程中遇到的坑太多了.在看页面的时候发现了页面滚动的问题,当一个页面滚动了,点击页面上的路由调到下一个页面时,跳转后的页面也是滚动的,滚动条并不是在页面的顶部 在我们写路由的时候做个处理,如下: import Vue from 'vue' import Router from 'vue-router' Vue.use(Router); Vue.use(Router) export default new Router({ routes: [ { path: '/',

vue:在路由跳转中使用拦截器

1:首先在路由对象中的某一个具体的路由对象加这样一个属性 meta: {  requireAuth:true  } 2:然后在main.js中添加这段代码 router.beforeEach((to, from, next) => { if (to.meta.requireAuth) { // 判断该路由是否需要登录权限 if (localStorage.getItem('a')) { // 通过vuex state获取当前的token是否存在,通过一个变量(vuex中或localstorage

vue实现非路由跳转以及数据传递

定义一个父组件 <template> <v-layout> <v-card contextual-style="dark" v-if="show"> <span slot="header"> 一级主页面 </span> <div slot="body">主内容页</div> <div slot="footer" :sh

vue 路由 以及默认路由跳转

https://router.vuejs.org/ vue路由配置: 1.安装 npm install vue-router --save / cnpm install vue-router --save 2.引入并 Vue.use(VueRouter) (main.js) import VueRouter from 'vue-router' Vue.use(VueRouter) 3.配置路由 1.创建组件 引入组件 2.定义路由 (建议复制s) const routes = [ { path:

vue之路由以及默认路由跳转

vue之路由以及默认路由跳转 之前我们将子组件挂载到根组件的时候都是手动挂载的,而路由就是自动的将子组件挂载到根组件中 在这里我们需要用到一个路由插件,就是 vue-router ,vue-router网址:https://router.vuejs.org/zh/guide/ 既然要用插件了那肯定要先安装啦. vue-router使用步骤: 1.安装vue-router    官网有说明 注意:安装时最好加上 --save  ,让其加入到package.js包中,方便被人使用.也可以使用cnpm

vue路由跳转的方式

vue路由跳转有四种方式 1. router-link 2. this.$router.push() (函数里面调用) 3. this.$router.replace() (用法同push) 4. this.$router.go(n) 一.不带参 1.1 router-link <router-link :to="{name:'home'}"> <router-link :to="{path:'/home'}"> //name,path都行,

Vue路由跳转

路由跳转 this.$router.push('/course'); this.$router.push({name:'course'}) this.$router.go(-1) // js逻辑使用history,完成返回上一页 this.$router.go(1) // 前进一页 <router-link to="/course">课程页</router-link> <router-link :to="{name:'course'}"

Vue之路由跳转传参,插件安装与配置

路由跳转 this.$router.push('/course'); this.$router.push({name:course}); this.$router.go(-1); //后退一页 this.$router.go(1): // 前进一页 <router-link to = "/course">课程页</router-link> <router-link :to="{name:'course'}"> 课程页 </r

详解vue 路由跳转四种方式 (带参数)

详解vue 路由跳转四种方式 (带参数):https://www.jb51.net/article/160401.htm 1.  router-link ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1. 不带参数  <router-link :to="{name:'home'}"> <router-link :to="{path:'/home'}"> //name,path都行, 建议用name /