$nuxt: The Nuxt helper
$nuxt is a helper designed to improve user experience.
For more info on the Nuxt helper check out the context and helpers chapter in the Concepts book
Connection checker
- 
isOffline- 
Type: Boolean
- 
Description: truewhen the user's internet connection becomes offline
 
- 
Type: 
- 
isOnline- 
Type: Boolean
- 
Description: Opposite of isOffline
 
- 
Type: 
layouts/default.vue
<template>
  <div>
    <div v-if="$nuxt.isOffline">You are offline</div>
    <nuxt />
  </div>
</template>
Refreshing page data
- 
refresh()- When you want to only refresh the data provided by asyncData or fetch
 
example.vue
<template>
  <div>
    <div>{{ content }}</div>
    <button @click="refresh">Refresh</button>
  </div>
</template>
<script>
  export default {
    asyncData() {
      return { content: 'Created at: ' + new Date() }
    },
    methods: {
      refresh() {
        this.$nuxt.refresh()
      }
    }
  }
</script>
Controlling the loading bar
- 
$loading- When you want to control Nuxt's loading bar programmatically
 
export default {
  mounted() {
    this.$nextTick(() => {
      this.$nuxt.$loading.start()
      setTimeout(() => this.$nuxt.$loading.finish(), 500)
    })
  }
}
 
        Edit this page on GitHub
        
      Updated at Mon, Aug 19, 2024
    
  Sébastien Chopin
 
        Sébastien Chopin
        Nazaré da Piedade
 
        Nazaré da Piedade
        Nobu
 
        Nobu
        川音리오
 
        川音리오
        Maciek Palmowski
 
        Maciek Palmowski
        Nestor Vera
 
        Nestor Vera
        Daniel Roe
 
        Daniel Roe
        Yue Yang
 
        Yue Yang
        Jeronimas
 
        Jeronimas
        Clément Ollivier
 
        Clément Ollivier
        Alexander Lichter
 
        Alexander Lichter
        N3-rd
 
        N3-rd
        Adrien Zaganelli
 
        Adrien Zaganelli
        Mag
 
        Mag
        Stefan Huber
 
        Stefan Huber
        Olga Bulat
 
        Olga Bulat
        Paiva
 
        Paiva
        Florian Reuschel
 
        Florian Reuschel
        Savas Vedova
 
        Savas Vedova
        HIJACK
 
        HIJACK
        Vinícius Alves
 
        Vinícius Alves
        Kareem Dabbeet
 
        Kareem Dabbeet
        Valentín Costa
 
        Valentín Costa
        Ryan Skinner
 
        Ryan Skinner
        Alex Hirzel
 
        Alex Hirzel
        Ajeet Chaulagain
 
        Ajeet Chaulagain
        René Eschke
 
        René Eschke
        Nico Devs
 
        Nico Devs
        Muhammad
 
        Muhammad
        Naoki Hamada
 
        Naoki Hamada
        Tom
 
        Tom
        Yann Aufray
 
        Yann Aufray
        Anthony Chu
 
        Anthony Chu
        Nuzhat Minhaz
 
        Nuzhat Minhaz
        Lucas Portet
 
        Lucas Portet
        Richard Schloss
 
        Richard Schloss
        Bobby
 
        Bobby
        bpy
 
        bpy
        Antony Konstantinidis
 
        Antony Konstantinidis
        Hibariya
 
        Hibariya
        Jose Seabra
 
        Jose Seabra
        Eze
 
        Eze
        Florian Lefebvre
 
        Florian Lefebvre
        Lucas Recoaro
 
        Lucas Recoaro
        Julien SEIXAS
 
        Julien SEIXAS