angular - 如何使用 Angular 5 在网页上隐藏图像
问题描述
这里我是使用 ng2-file-input 输入图像,图像输入成功但图像显示在网页上,所以当我上传图像时,我不希望网页中显示的图像隐藏图像,因为它上传了后端。下面我分享了我的 HTML 代码。如果您有任何疑问,请在评论中问我,我会澄清。提前谢谢您。
<ng2-file-input class="Browse" (onAction)="onAction($event)" [multiple]="false" [hidden]="Key" [extensions]="['doc','pdf','txt','jpg','png']"></ng2-file-input>
解决方案
在您的代码中,请检查您
showPreviews:true;
对 false 的更改并停止显示上传图片的预览
Ng2FileInputModule.forRoot(
{
dropText:"Drop file here";
browseText:"Browse";
removeText:"Remove";
invalidFileText:"You have picked an invalid or disallowed file."
invalidFileTimeout:8000;
removable:true;
multiple:false;
showPreviews:true;
extensions:['jpg'];
}
),
或者你试试这个
[showPreviews]:false
添加在下面的行
<ng2-file-input class="Browse" (onAction)="onAction($event)" [multiple]="false" [hidden]="Key" [showPreviews]:false [extensions]="['doc','pdf','txt','jpg','png']"></ng2-file-input>
推荐阅读
- android - 从库项目中杀死一个应用程序进程
- reactjs - ReactJS 从另一个组件调用一个函数
- python-3.x - ModuleNotFoundError:没有名为“keybord”的模块
- javascript - VueJS“RangeError:超出最大调用堆栈大小”
- azure - 如何将我的 GoDaddy 域连接到 Azure VM 服务器?
- python - 我无法通过 Django 中的最近聊天来组织我的消息
- java - 重用 Java (Swing) 中已经实现的函数
- reactjs - React Helmet:根据配色方案更改图标
- firebase - Cloud Firestore - how to stop “any user can read your entire database” error email
- react-native - ReactNative:SectionList SectionHeaders 覆盖 ListFooter