1.0.0 • Published 10 days ago

vue3-localstorage-sync v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 days ago

vue3-localstorage-sync npm

English|中文

This project is based on Vue3's watch method and browser's native localStorage, achieving data synchronization between same-origin pages by listening to the storage event of the window object.

Installation

npm i vue3-localstorage-sync

Usage

Import useBind method from vue3-localstorage-sync:

import { useBind } from 'vue3-localstorage-sync'

Create a ref or reactive object and pass in a unique key as the binding basis. Optionally, use the returned reactive object. The data will be stored in the browser's localStorage under the provided key.

// Method 1
const count = useBind(ref(0), 'count');

// Method 2
const count = ref(0);
useBind(count, 'count')
1.0.0

10 days ago

0.1.4

1 month ago

0.1.5

1 month ago

0.1.3

2 months ago

0.1.2

2 months ago

0.1.1

2 months ago

0.1.0

2 months ago