【发布时间】:2021-05-05 19:48:20
【问题描述】:
所以, 我有一个附加了一些其他页面的登录页面,例如,landing/gothere 将我带到属于 /gothere 的登录部分,我有 /another 这是一个附加页面 问题是当我试图从 /another 到landing/gothere 时,因为我正在使用来自 api 的数据获取着陆信息,当我点击导航栏时,我去了正确的地方,但信息不存在然而,然后 api 加载页面,我在我想去的地方和它带我去的地方之间有这个差距。 在我将所有内容连接到 cms 之前,页面工作正常。 这是我在导航栏中使用的 nuxt 链接
<nuxt-link
:to="{
name: 'index',
hash: '#expertises',
params: { offset: 100 },
}"
class="nav-link"
>Nos expertises
</nuxt-link>
PD:我已经尝试过以这种方式使用 this.$route:
if (this.$route.params.hash) location.href = this.$route.params.hash;
将 nuxt 链接更改为:
<nuxt-link
:to="{
name: 'index',
params: { hash: '#offres' },
}"
class="nav-link"
>Nos offres
</nuxt-link>
但是使用这种方法,导航栏只有在我在一个附加页面中时才有效,如果我在着陆页中,它就不起作用。 提前谢谢你
【问题讨论】:
标签: javascript html vue.js nuxt.js