vue.js - Vue-router 无法在新选项卡中绑定数据
问题描述
内部选项卡一切正常,但是当我在新选项卡中打开链接时。我收到这个错误。
- 这是我的路由器链接(标签索引):
<router-link tag="a" class="cursor-pointer text-primary" :to="{path: 'articles/edit/'+props.row._id}">{{ props.row.title }} </router-link>
这是目标页面:
安装:
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)
}
}
解决方案
您是否在 ArticleEdit.vue 中使用扩展运算符(“...”)?
我需要查看更多代码才能理解。
推荐阅读
- node.js - 随机数生成算法
- asp.net - EntityFramwork - 如何使用现有数据库并应用迁移,同时仍支持自动升级?
- javascript - 建立安全连接会延迟主页加载 (adsense)
- javascript - 如何将页面上某些元素的连接属性值作为字符串返回
- ios - 更新 PFObject 未按预期工作
- python - 熊猫:无法导入名称兼容
- c - 传递 C 字符串并将其与本地指针一起使用
- mysql - 如何查询最近日期并显示具体数据
- javascript - 如何正确删除表格单元格
- flutter - Flutter RenderFlex 在 Column Widget 内右侧溢出 15 个像素