yarn add vue-network
CDN: UNPKG | jsDelivr (available as window.VueNetwork
)
<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>
online
: The slot to show when app is online.offline
: The slot to show when app is offline.
changedOnly
: Only show slots after network status is changed, i.e. render nothing on the first render.
changed<online>
: Emitted after network status is changed, eg:
<network @changed="handleNetworkChanged"></network>
function handleNetworkChanged(online) {
console.log(online)
}
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
vue-network © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
egoist.moe · GitHub @EGOIST · Twitter @_egoistlily