【问题标题】:Vue-router cannot binding data in a new tabVue-router 无法在新选项卡中绑定数据
【发布时间】:2020-09-29 09:04:40
【问题描述】:

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

  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.js vuex vue-router


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2021-06-19
      • 2022-11-26
      • 2018-09-18
      • 1970-01-01
      • 2017-07-14
      • 2017-07-04
      • 2017-09-26
      • 2015-07-24
      • 1970-01-01
      相关资源
      最近更新 更多