小编eng*_*ave的帖子

如何将谷歌字体添加到盖茨比网站

Gatsby入门 - 当我使用google字体向public/index.html添加链接标记时,它在开发模式下工作.当我构建网站时,index.html会重置.所以我想还有另一种正确的方法来添加字体?

fonts reactjs gatsby

21
推荐指数
4
解决办法
2万
查看次数

如何在nuxt.js中访问路由器对象

我正在使用基于vue.js的nuxt.js开发一个网站。该站点是一个简单的站点,其中包含许多页面。我想创建一个知道其内容在哪里的组件,因此需要访问路由器对象。我已经尝试过$nuxt.$route.path但出现错误。如何导入$nuxt$router对象以在组件中访问它们?

我的模板组件

<template>
  <div>
      <hr>
      <p>{{ $store.state.menuitems[0] }}</p>
      <hr>
      <div class="artfooter">
        <span>i want name of current route here</span>
      </div>
      <br>
  </div>
</template>


<style scoped>
.artfooter{
    font-size: 0.8em;
    display: flex;
    justify-content: space-between;
}
</style>



<script>
  import store from '~/store/index'
  //how to import $nuxt object to access router??
  console.log(store)
  console.log(this.$router.path)
  // the above console.log reports error
  // Cannot read property 'middleware' of undefined

  export default {
  }
</script>
Run Code Online (Sandbox Code Playgroud)

javascript frontend vuejs2 nuxt.js

0
推荐指数
1
解决办法
3035
查看次数

标签 统计

fonts ×1

frontend ×1

gatsby ×1

javascript ×1

nuxt.js ×1

reactjs ×1

vuejs2 ×1