nuxt 如何在页面名称后添加问号 [英] nuxt how to have a question mark after the page name

查看:29
本文介绍了nuxt 如何在页面名称后添加问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个设置:

pages/
--| search/
-----| _index.vue

我想要一个这样的网址:

And I want to have a url like this:

myApp.com/search/?parameter=1

但是当我在 search 之后手动将 ?parameter=1 放入 url 时,它告诉我 无法找到此页面.如何实现路由,以便在 / 之后我可以有 ? 没有错误?

But when I manually put ?parameter=1 into url after search it tells me This page could not be found. How can I achieve routing such that after / I can have ? without no errors?

推荐答案

将您的 _index.vue 更改为 _id.vue,这是 nuxt 默认的

Change your _index.vue to _id.vue which is the nuxt default

https://codesandbox.io/s/blissful-wave-cjqp7?file=/pages/search/_id.vue

这篇关于nuxt 如何在页面名称后添加问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆