【问题标题】:Nuxt.js and anchorsNuxt.js 和锚点
【发布时间】:2019-03-16 12:43:32
【问题描述】:

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

问题是 URL 始终保持在基础 localhost:3000/ 我也想在 URL 上显示锚点:localhost:3000/#anchor1localhost:3000/#anchor2localhost:3000/#anchor3……等等。

看来<nuxt-link :to=(/#anchorid)> Inner link </nuxt-link> 做不到。

如何实现这个功能?

【问题讨论】:

    标签: javascript vue.js nuxt.js


    【解决方案1】:

    如果使用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" />
    

    【讨论】:

      猜你喜欢
      • 2013-05-02
      • 1970-01-01
      • 1970-01-01
      • 2020-06-02
      • 1970-01-01
      • 1970-01-01
      • 2017-01-19
      • 1970-01-01
      • 2023-03-12
      相关资源
      最近更新 更多