如何处理Nuxt.js中的锚(在同一页面内)?
问题是URL始终位于 localhost:3000/ 我也希望在URL上显示锚: localhost:3000/#anchor1 localhost:3000/#anchor2 , localhost:3000/#anchor3 等。
localhost:3000/
localhost:3000/#anchor1
localhost:3000/#anchor2
localhost:3000/#anchor3
看起来 <nuxt-link :to=(/#anchorid)> Inner link </nuxt-link> 不做这项工作。
<nuxt-link :to=(/#anchorid)> Inner link </nuxt-link>
如果使用 locales
locales
<nuxt-link :to="localePath({ name: 'index', hash: '#anchor1'})" v-text="Anchor 1" alt="Anchor 1"> </nuxt-link>
<nuxt-link to="/anchor1" v-text="Anchor 1" />