Nuxt.js中的无限动态级别嵌套 [英] Infinite dynamic level nesting in Nuxt.js

查看:403
本文介绍了Nuxt.js中的无限动态级别嵌套的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让nuxt.js的路由完全动态,因为我无法预测用户及其偏好程度,因为他希望拥有的水平。

I would like to have the routing of nuxt.js fully dynamic, because I can't predict the user and his preferences about the amount of levels he would like to have.

因此,一个用户将创建这样的页面:

http:// localhost / parent / level-1 / level-2 /

So one user would create a page like this:
http://localhost/parent/level-1/level-2/

其他一些人会这样:

http:// localhost / parent / level-1 / level-2 / level-3 / level-4 / level-5 / level-6 / level-7 /

nuxt.js是否可以使用此无限嵌套路由?

Is there a way that nuxt.js will work with this infinite nested routing?

推荐答案

能够制作单个文件:

pages/_.vue

这将捕获与特定请求不匹配的所有请求。

This will catch any requests that do not match a more specific request.

但是请注意,这没有用编辑的后果。例如,您可能要返回404错误等,并且使用此方法将始终导致匹配任何路由。开发人员可以自行决定如何处理丢失的页面。

But note that this has unintended consequences. For instance, you may want to return 404 errors and the like, and using this method will always result in any route being matched. This leaves it up to you the developer to decide how to handle missing pages.

这篇关于Nuxt.js中的无限动态级别嵌套的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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