useWeb

Web APIs implemented as Vue.js composition functions

Get Started →

Reactive

All the APIs have been repurposed to be reactive so you can use them directly in your components.

Graceful Degradation

Sensible fallbacks are in place if the browser does support an API or the user doesn't give the permission.

TypeScript Support

Written in TypeScript.

Quick Setup

Web APIs implemented as Vue.js composition functions. currently usable with the @vue/composition-api adapter for Vue.js 2.x.

Installation

# install with yarn
yarn add @vue/composition-api vue-use-web

# install with npm
npm install @vue/composition-api vue-use-web

Web APIs

Usage

<template>
  <div>User position is: {{ coords.longitude }} {{ coords.latitude }}</div>
</template>

<script>
import { useGeolocation } from 'vue-use-web';

export default {
  setup() {
    const { coords } = useGeolocation();

    return { coords };
  }
};
</script>