tserkov / vue-plugin-load-script

A Vue plugin for injecting remote scripts.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What about CompositionAPI import?

professrr opened this issue · comments

How to import something like loadScript using the Composition API?

commented

I personally haven't made the switch yet. Looking at the documentation, supporting Vue 3 may be backwards compatible, so I'll take a crack at it.

From #20, it would be as simple as const useLoadScript = () => ({ loadScript, unloadScript }), although there's no reason to have a hook for the sake of hook. Named exports are enough because it doesn't do anything specific to component instance.

Composition API is now supported for vue 3. Added in #20