美文网首页
2、Vue Router

2、Vue Router

作者: 懒羊羊3号 | 来源:发表于2018-08-31 09:57 被阅读0次

1、路由跳转

// 跳转前页面
            <router-link
              v-if="scope.row.renewal"
              class="text-button"
              :to="{ name: 'customer-renewal-management', query: { position: positionMapping[scope.row.renewal.status] } }">
              {{ scope.row.renewal.status | hyToText('renewalStatusText') }}
            </router-link>
//跳转后页面
    beforeRouteEnter (to, from, next) {
      next(vm => {
        const tabPosition = to.query.position || 1
        const mapping = {
          1: 'statusPending',
          2: 'statusFail',
          3: 'statusSuccess',
          4: 'statusToBe'
        }
        vm.activeName = mapping[Number(tabPosition)]
      })
    },

相关文章

网友评论

      本文标题:2、Vue Router

      本文链接:https://www.haomeiwen.com/subject/jatswftx.html