首页 > 解决方案 > Vue-router 无法在新选项卡中绑定数据

问题描述

内部选项卡一切正常,但是当我在新选项卡中打开链接时。我收到这个错误。

指数

  1. 这是我的路由器链接(标签索引):
 <router-link tag="a" class="cursor-pointer text-primary" :to="{path: 'articles/edit/'+props.row._id}">{{ props.row.title }}
</router-link>
  1. 这是目标页面:

安装:

mounted () {
        const articleId = this.$route.params.id

        this.loadArticle(articleId)
    },

Vuex

export async function loadArticles ({ commit }, { currentPage, perPage, status, subscriptions, validFrom, validThrough, approved, active, category, search  }) {
    commit('setArticlesBegin')
    try {
        const query = {
            skip: (currentPage - 1) * perPage,
            limit: perPage,
            search : search || '',
            category: category || '',
            validFrom: validFrom || '',
            validThrough: validThrough || '',
            approved: approved || null,
            active: active || null,
        }
        if (status) {
            query.status = status
        }

        const  {total, articles} = await api.getAll(query, 'admin')
        commit('setArticles', {
            articles,
            total,
            currentPage
        })
    } catch (error) {
        commit('setError', error)
    }
}

在此处输入图像描述

在此处输入图像描述

标签: vue.jsvuexvue-router

解决方案


您是否在 ArticleEdit.vue 中使用扩展运算符(“...”)?

我需要查看更多代码才能理解。


推荐阅读