vue.js - nuxt如何在页面名称后加问号
问题描述
我有这个设置:
pages/
--| search/
-----| _index.vue
我想要一个这样的网址:
myApp.com/search/?parameter=1
但是当我手动?parameter=1
输入 url 后search
它告诉我This page could not be found
。我怎样才能实现路由,这样/
我就可以?
没有错误了?
解决方案
这是一个干净的方法。
/pages/search-page.vue
<template>
<div>This is the search page</div>
</template>
<script>
export default {
name: 'SearchPage',
mounted() {
console.log('query >>', this.$route.query.search)
},
}
</script>
推荐阅读
- python - 如何通过匹配 Pandas 数据框中的日期变量来进行 5 年计算?
- regex - 似乎找不到正则表达式匹配的索引
- xcode - 防止 Catalina 在每个新的 Xcode 构建中请求应用程序权限(如麦克风或钥匙串访问)
- c++ - 使用基数 10 转换数字的程序中的控制流
- javascript - NativeModules.DevSettings.reload() 在构建版本中不起作用
- c - 将char转换为int时我做错了什么?
- prolog - 替换 Prolog 中的子句
- authentication - 如何在颤振应用程序的入口点检查身份验证令牌
- reactjs - 将图像文件从 React 上传到 Laravel (API)
- c++ - 我正在尝试练习新功能和删除功能,但我的代码“触发断点”