Skip to content

useExternal ​

Dynamically load JS or CSS, useExternal can ensure that the resource are globally unique.

Code demonstration ​

Basic Usage ​

Load CSS ​

API ​

typescript
const status = useExternal(path: string, options?: Options);

Params ​

PropertyDescriptionTypeDefault
pathThe url of the external resourcesstring-

Result ​

PropertyDescriptionType
statusThe progress of loading the external resources, support unset, loading, ready, errorReadonly<Ref<UseExternalStatus>>

Options ​

PropertyDescriptionTypeDefault
typeThe type of extarnal resources which need to load, support js/css, if no type, it will deduced according to pathstring-
jsAttributes supported by scriptHTMLScriptElement-
cssAttributes supported by linkHTMLStyleElement-

Source ​

Source · Document · Demo

Released under the MIT License.