-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'd like to ask about the progress of vue3 support #157
Comments
Indeed, when I try to use it in VUE-CLI4, It will throw out this error: |
+1 |
1 similar comment
+1 |
no one supports this project? |
在utils/index文件上 |
To easily migrate multiple Vue 2 apps that are dependent on having import { MemoryStorage, WebStorage } from 'vue-ls/src/storage'
// eslint-disable-next-line
const _global = typeof window !== 'undefined' ? window : global || {}
/**
* @type {import('vue').Plugin}
*/
const VueStorage = {
install(app, options = {}) {
const _options = Object.assign({}, options, {
storage: options.storage || 'local',
name: options.name || 'ls',
})
if (
_options.storage &&
['memory', 'local', 'session'].indexOf(_options.storage) === -1
) {
throw new Error(`Vue-ls: Storage "${_options.storage}" is not supported`)
}
let store = null
switch (_options.storage) {
case 'local':
store = 'localStorage' in _global ? _global.localStorage : null
break
case 'session':
store = 'sessionStorage' in _global ? _global.sessionStorage : null
break
case 'memory':
store = MemoryStorage
break
}
if (!store) {
store = MemoryStorage
console.error(
`Vue-ls: Storage "${_options.storage}" is not supported your system, use memory storage`,
)
}
const ls = new WebStorage(store)
ls.setOptions(
Object.assign(
ls.options,
{
namespace: '',
},
_options || {},
),
)
app.config.globalProperties[`$${_options.name}`] = ls
},
}
export default VueStorage This is based in https://github.com/RobinCK/vue-ls/blob/e5bc3388b9e4f6c860dae3b4ab2b89f33e939c60/src/index.js, but with the last part changed ( |
I'd like to ask about the progress of vue3 support, thanks
The text was updated successfully, but these errors were encountered: