这是我的代码。它在 Chrome 上运行良好,但在 IE 上运行太慢。我尝试使用 javascript 而不是 jquery 但没有任何改变!
大家都说innerHTML 比append 快。但是当我使用innerHTML而不是append时,什么都没有改变。我真的需要一些建议。谢谢
<input id="uploadPhoto" name="uploadPhoto" type="file" multiple accept="image/*" />
$("#uploadPhoto").on('change', function () {
var $this = $(this);
var countOfFiles = $this[0].files.length;
var maxSize = countOfFiles * 5242880;
if($this[0].files[0].size > maxSize)
{
$.smallBox({
title : "too big size",
color : "#c69120",
iconSmall : "fa fa-warning fa-2x fadeInRight animated",
timeout : 9000
});
$('#uploadPhoto').val('');
}
else
{
var input = document.getElementById('uploadPhoto');
var files = $this[0].files;
var imgPath = $this[0].value;
var extn = …Run Code Online (Sandbox Code Playgroud) 我正在使用 primeng 日历,但无法从数据库设置日期。这是我来自服务器的日期:2018-04-17T16:41:47.683
当我尝试将格式更改为“YYYY.MM.DD HH.MM”时,我在控制台上收到此错误:未捕获(承诺中):位置 2 处出现意外的文字
当我将日期时间转换为字符串时,我收到相同的错误我不知道该怎么办。请帮忙![![1]](https://i.stack.imgur.com/0ZzDp.png)
这是我的代码:
组件.html
<p-calendar id="StartDate" inputStyleClass="form-control" [showIcon]="true" showTime="true" hourFormat="24" [locale]="tr"
name="StartDate" [(ngModel)]="datex"></p-calendar>
<!-- <p-calendar id="StartDate" inputStyleClass="form-control" [showIcon]="true" showTime="true" hourFormat="24" [locale]="tr"
name="StartDate" [(ngModel)]="contentTranslate.StartDate"></p-calendar> -->
Run Code Online (Sandbox Code Playgroud)
PS:我用 ngmodel 尝试了两种方法。
组件.ts
ngOnInit() {
this.getLanguageDetail(this.contentId, this.langId); }
getLanguageDetail(contentId: number, langId: number): any {
this.contentService
.getTranslateDetail(contentId, langId)
.subscribe(x => this.detailResultFunc(x));
}
detailResultFunc(x: any): any {
if (x) {
this.contentTranslate = x;
const tmpDate: string = moment(this.contentTranslate.StartDate).format('YYYY.MM.DD HH:MM');
this.datex = tmpDate; new Date(tmpDate).toLocaleDateString(); //.toLocaleDateString().trim();
} else {
this.contentTranslate …Run Code Online (Sandbox Code Playgroud) angular5 ×1
datetime ×1
filereader ×1
html ×1
javascript ×1
jquery ×1
primeng ×1
typescript ×1