代码之家  ›  专栏  ›  技术社区  ›  Begueradj

Nuxt.js和锚

  •  0
  • Begueradj  · 技术社区  · 7 年前

    如何处理Nuxt.js中的锚(在同一页面内)?

    问题是URL始终位于 localhost:3000/ 我也希望在URL上显示锚: localhost:3000/#anchor1 localhost:3000/#anchor2 , localhost:3000/#anchor3 等。

    看起来 <nuxt-link :to=(/#anchorid)> Inner link </nuxt-link> 不做这项工作。

    0 回复  |  直到 7 年前
        1
  •  0
  •   Madhuri kulkarni    6 年前

    如果使用 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" />
    
    推荐文章