Skip to content

jcalixte/vue-online-offline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-online-offline

Vue Component with online/offline slots

Project setup

npm install vue-online-offline

or

yarn add vue-online-offline

Usage

<template>
  <vue-online-offline @online="isOnline" @offline="isOffline">
    <div slot="online">I'm online! 🎉</div>
    <div slot="offline">I'm offline. 🤨</div>
  </vue-online-offline>
</template>

<script>
import VueOnlineOffline from 'vue-online-offline'

export default {
  components: { VueOnlineOffline },
  methods: {
    isOnline() {
      console.log(`Now I'm online!`)
    },
    isOffline() {
      console.log(`Now I'm offline.`)
    }
  }
}
</script>