Skip to content
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

fix(useExternal): add an attribute (option.type) to specify the type of external resource #828

Merged
merged 3 commits into from
Jan 24, 2021

Conversation

turkyden
Copy link
Contributor

Fix #819

const [status, { toggle, unload, load }] = useExternal(path: string, options?: Options);

新增 options.type, 若 useExternal 中的正则表达式无法匹配上外部资源,则需用户自行指定外部资源类型。

目前支持 js css img 三种外部资源。

Options

参数 说明 类型 默认值
type 需引入外部资源的类型,支持 js/css/img string -
async 引入外链脚本的 <script> 的 async 属性 boolean true
media 引入外链样式表 <link> 的 media 属性, 如 all/screen/print/handheld string all
target 需插入外部图片资源 <img> 的父容器 DOM 节点或者 Refs HTMLElement | (() => HTMLElement) | MutableRefObject -

…of external resource

add an attribute (option.type) to specify the type of external resource

fix alibaba#819
@brickspert brickspert merged commit 88ca155 into alibaba:master Jan 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useExternal无法加载高德地图js
3 participants