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

upload After removing the automatic upload, the thumbnail is not displayed, the console is reported incorrectly, the sample code is as follows #3476

Closed
wushuxuan opened this issue May 22, 2019 · 4 comments

Comments

@wushuxuan
Copy link

wushuxuan commented May 22, 2019

Reproduction link

https://stackblitz.com/run

Steps to reproduce

Import { Component } from '@angular/core';
Import { UploadFile } from 'ng-zorro-antd';
@component({
  Selector: 'app-image-picker',
  Template: ` <div class="clearfix"> 
 <nz-upload
	nzListType="picture-card" 
	[(nzFileList)]="fileList"
	[nzShowButton]="fileList.length < 3"
	[nzShowUploadList]="showUploadList"
	[nzPreview]="handlePreview"
	[nzBeforeUpload]="beforeUpload">
	<i nz-icon nzType="plus"></i>
	<div class="ant-upload-text">Upload</div>
</nz-upload>

<nz-modal
	[nzVisible]="previewVisible"
	[nzContent]="modalContent"
	[nzFooter]="null"
	(nzOnCancel)="previewVisible = false">
	<ng-template #modalContent>
		<img [src]="previewImage" [ngStyle]="{ width: '100%' }" />
	</ng-template>
</nz-modal>
</div>  ` ,
  Styles: [ `
	i[nz-icon] {
		Font-size: 32px;
		Color: #999;
	}
	.ant-upload-text {
		Margin-top: 8px;
		Color: #666;
		} 
	`  
  ]
})
Export class ImagePickerComponent {
  showUploadList = {
    showPreviewIcon: true,
    showRemoveIcon: true,
    hidePreviewIconInNonImage: true
  };
  fileList: UploadFile[] = [];
  previewImage: string | undefined = '';
  previewVisible = false;
  Constructor() { }
  beforeUpload = (file: UploadFile, ) => {
    this.fileList = this.fileList.concat(file);
    Return false;
  }
  handlePreview = (file: UploadFile) => {
    this.previewImage = file.url || file.thumbUrl;
    this.previewVisible = true;
  };
}

What is expected?

手动上传模式,type="picture-card" 时依旧显示缩略图,功能如 Ant Design - React upload控件

What is actually happening?

手动上传模式,type="picture-card" 时不显示缩略图,浏览器报错,报错信息如下:

ERROR TypeError: child.getAttribute is not a function
    at NzIconService.push../node_modules/@ant-design/icons-angular/fesm5/ant-design-icons-angular.js.IconService._colorizeSVGIcon (ant-design-icons-angular.js:614)
    at NzIconService.push../node_modules/@ant-design/icons-angular/fesm5/ant-design-icons-angular.js.IconService._loadSVGFromCacheOrCreateNew (ant-design-icons-angular.js:540)
    at MapSubscriber.project (ant-design-icons-angular.js:407)
    at MapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/map.js.MapSubscriber._next (map.js:35)
...........................
Environment Info
ng-zorro-antd 7.4.1
Browser chrome
@wushuxuan
Copy link
Author

这个问题是我使用的有问题还是目前不能提供这项功能的支持呢?

@cipchk
Copy link
Member

cipchk commented May 23, 2019

@wushuxuan 麻烦提供一个可用的重现链接,我尝试修改一下你的代码格式,但是我依然无法跑起来。

另从报错信息来看似好像是 nz-icon 产生的问题。

@zorro-bot
Copy link

zorro-bot bot commented Jan 7, 2020

Hello @wushuxuan. Please provide a online reproduction by forking this link https://stackblitz.com/edit/ng-zorro-antd-start or a minimal GitHub repository.
Issues labeled by Need Reproduce will be closed if no activities in 7 days.

你好 @wushuxuan, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 stackblitz 或者提供一个最小化的 GitHub 仓库
被标记为 Need Reproduce 的 issue 7 天内未跟进将会被自动关闭。

@no-response
Copy link

no-response bot commented Jan 14, 2020

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. If you can provide more information, feel free to ping anyone of our maintainers to reopen this issue. Thank you for your contributions. --- 这个 issue 已经被自动关闭,因为您没有向我们提供更多的信息。仅凭目前的描述我们无法采取任 何行动,如果您能提供更多的信息请随时联系我们的开发人员重新打开这个 issue。 感谢您的贡献。

@no-response no-response bot closed this as completed Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants