vue.js - Nuxt-link 更改 url 但不更改页面内容
问题描述
每当我在components/feed.vue中使用它时:
<template><div><nuxt-link :to="{path: '/videos/new', query: { page:nextpage(currentpage) } }">next</nuxt-link></div></template>
或者
<template><div><nuxt-link :to="'/videos/new/?page=' + nextpage(currentpage)">next</nuxt-link></div></template>
当我点击链接时,网址发生了变化,但内容保持不变,我错过了什么吗?
编辑:当我在“/”上时它可以工作,但如果我已经在“/videos/new”上它就不行
解决方案
最后很简单,只需要添加 watchQuery :
export default {
watchQuery: ['page', 'order', 'q']
}
推荐阅读
- sql-server - 使用姓氏的前 3 个字符和序列号创建唯一 ID
- ios - 尝试显示带有消息的 UIAlertController 时应用程序崩溃:由于未捕获的异常“NSInvalidArgumentException”而终止应用程序
- ibm-cloud-private - 如何更改 Microclimate 推送存储库?
- apache - 可以通过命令行启动 Apache,但不能通过 Wamp Server
- python - 替换并添加到python3中的数组切片
- matplotlib - 向 Shapefile 地图添加标签
- haskell-stack - 如何让堆栈看到依赖关系?
- php - PHP iconv 从 utf-8 到 windows-1252,没有特殊字符
- python - Pandas 在单个条形图上绘制多列
- excel - 将更新相同值列中的单元格的触发器