Skip to content

egoist/vue-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-network

NPM version NPM downloads CircleCI donate chat

Install

yarn add vue-network

CDN: UNPKG | jsDelivr (available as window.VueNetwork)

Usage

<template>
  <network>
    <span slot="online">network is fine</span>
    <span slot="offline">oops, lost network connection</span>
  </network>
</template>

<script>
import Network from 'vue-network'

export default {
  components: {
    Network
  }
}
</script>

API

Slots

  • online: The slot to show when app is online.
  • offline: The slot to show when app is offline.

Props

  • changedOnly: Only show slots after network status is changed, i.e. render nothing on the first render.

Events

  • changed<online>: Emitted after network status is changed, eg:
<network @changed="handleNetworkChanged"></network>
function handleNetworkChanged(online) {
  console.log(online)
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

vue-network © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).

egoist.moe · GitHub @EGOIST · Twitter @_egoistlily

About

Render a Vue component to indicate network status.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 2

  •  
  •