-
Notifications
You must be signed in to change notification settings - Fork 1
Description
This is one of my favourite Vue plugins, really makes it a lot easier to display custom loading states for multiple elements, and I'd be sad if I had to leave it behind for Vue 3.
I tried to take a stab at it myself, but I'm really slowed down by my lack of Typescript knowledge, so I imagine it might be much quicker if done by, say, someone who knew Typescript.
So far, I've changed it so that LoadableMixin
returns an object, not a Vue.extend()
, and changed install
to work like:
export function install(app: VueConstructor): void {
app.mixin(LoadableMixin);
}
However, the way I want to use it is using Vue3's composition API, like so:
const createProject = loadable((values) => store.dispatch('Projects/createProject', values));
The problem I'm running into is that loadable
relies on this
, and the context of the current component isn't passed in there. I think it probably requires some clever .bind()
calls, though I'm not sure where and this is where my lack of TS knowledge is really hampering me.