{"id":27704425,"url":"https://github.com/ropbla9/vue-reactive-storage","last_synced_at":"2025-04-26T01:01:54.529Z","repository":{"id":57396567,"uuid":"70089015","full_name":"rop7/vue-reactive-storage","owner":"rop7","description":"Reactive layer for interacting with localStorage from Vue. Plugin for Vue 2.","archived":false,"fork":false,"pushed_at":"2018-06-14T00:57:03.000Z","size":45,"stargazers_count":126,"open_issues_count":5,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T09:11:57.293Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rop7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-05T18:48:00.000Z","updated_at":"2025-03-23T17:56:14.000Z","dependencies_parsed_at":"2022-08-27T14:18:37.644Z","dependency_job_id":null,"html_url":"https://github.com/rop7/vue-reactive-storage","commit_stats":null,"previous_names":["ropbla9/vue-reactivestorage","rop7/vue-reactive-storage","ropbla9/vue-reactive-storage"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rop7%2Fvue-reactive-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rop7%2Fvue-reactive-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rop7%2Fvue-reactive-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rop7%2Fvue-reactive-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rop7","download_url":"https://codeload.github.com/rop7/vue-reactive-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250917360,"owners_count":21507562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-26T01:01:42.992Z","updated_at":"2025-04-26T01:01:54.512Z","avatar_url":"https://github.com/rop7.png","language":"JavaScript","funding_links":[],"categories":["实用库"],"sub_categories":[],"readme":"# vue-reactive-storage\nReactive layer for interacting with localStorage from Vue. Plugin for Vue 2.\n\n### install\n\n`npm install --save https://github.com/ropbla9/vue-reactive-storage`\n\n* This package is not on NPM, use GitHub source only.\n\n### why\n\n`window.localStorage` cannot be reactive if you use it directly with Vue, ex\n\n```js\nnew Vue({\n    data {\n      localStorage: window.localStorage\n    },\n    template: \" \u003cdiv\u003e {{localStorage.notes}}, {{localStorage.lang}} ... \u003c/div\u003e \",\n    created: function() {\n        this.localStorage.lang = \"other value\";\n    }\n})\n```\n\nCode above will not react, even bind to view. So...\n\n### how to use\n\n```js\nimport reactiveStorage from \"vue-reactive-storage\";\n// Set initial values\nVue.use(reactiveStorage, {\n    \"notes\": 'foo',\n    \"lang\": 'foo',\n    \"name\": 'foo',\n    \"count\": 1,\n    \"userConfig\": {age: 10, name: 'fred'}\n});\n```\n\nDefine vars that will be stored and proxied by `Vue` (any other var in `window.localStorage` that is not on this array will not be proxied).\n\nNow you can acess the namespace \u003ccode\u003elocalStorage\u003c/code\u003e in Vue.\n\n```js\nnew Vue({\n    template: \" \u003cdiv\u003e {{localStorage.notes}}, {{localStorage.lang}} ... \u003c/div\u003e \",\n    created: function() {\n        this.localStorage.lang = \"other value\"; // will react on the view and on real localStorage.\n    }\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropbla9%2Fvue-reactive-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fropbla9%2Fvue-reactive-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fropbla9%2Fvue-reactive-storage/lists"}