0.0.7 • Published 2 years ago

vue3-usestate v0.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Vue3 useState Composable

Clone of Nuxt3's useState composable

Install

NPM

npm install vue3-usestate

Yarn

yarn add vue3-usestate

Usage

import { useState } from 'vue3-usestate'

setup() {
    const counter = useState('counter', 0)
    return { counter }
}

Plugin

Inject state to every instance under this.$state global property

// main.js
import VueUseState from 'vue3-usestate'

createApp(App).use(VueUseState).mount('#app')

Global Property

// App.vue
computed: {
    state() { return this.$state }
}

or

<template>
    <div>{{ $state.counter }}</div>
</template>
0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago