离子4离子按钮中的下载属性是什么意思?
What is the meaning of download property in ionic 4 ion-button?
我想在用 ionic 4 开发的网络应用程序中实现一个下载按钮。我读到我可以在 ion-button
中添加一个下载 属性
Download: This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want).
好像保存提示里的属性会是文件名,所以我的问题是下载放哪里url。
<ion-button download="MyFavicon" href="/assets/icon/favicon.png">My Icon</ion-button>
根据我在 Ionic 文档中找到的内容并进行了测试,下载属性似乎与锚标记下载属性完全一样。我在关于 href 属性 的离子按钮 docs 中找到了这个:
Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
似乎带有 href 属性 的离子按钮呈现为锚标记,然后可以使用下载属性。在测试期间,我只能下载我应用程序域内的图像。我猜这是一个跨源的东西。
希望对您有所帮助。
我想在用 ionic 4 开发的网络应用程序中实现一个下载按钮。我读到我可以在 ion-button
中添加一个下载 属性Download: This attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want).
好像保存提示里的属性会是文件名,所以我的问题是下载放哪里url。
<ion-button download="MyFavicon" href="/assets/icon/favicon.png">My Icon</ion-button>
根据我在 Ionic 文档中找到的内容并进行了测试,下载属性似乎与锚标记下载属性完全一样。我在关于 href 属性 的离子按钮 docs 中找到了这个:
Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
似乎带有 href 属性 的离子按钮呈现为锚标记,然后可以使用下载属性。在测试期间,我只能下载我应用程序域内的图像。我猜这是一个跨源的东西。
希望对您有所帮助。