我正在使用直接Web Remoting (DWR) JavaScript库文件,只在Safari(桌面和iPad)中得到一个错误
它说
超过最大调用堆栈大小。
这个错误到底是什么意思,它是否完全停止处理?
Safari浏览器也有任何修复(实际上是在iPad Safari上,它说
JS:执行超时
我认为这是相同的调用堆栈问题)
我正在使用直接Web Remoting (DWR) JavaScript库文件,只在Safari(桌面和iPad)中得到一个错误
它说
超过最大调用堆栈大小。
这个错误到底是什么意思,它是否完全停止处理?
Safari浏览器也有任何修复(实际上是在iPad Safari上,它说
JS:执行超时
我认为这是相同的调用堆栈问题)
当前回答
dtTable.dataTable({
sDom: "<'row'<'col-sm-6'l><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
"processing": true,
"serverSide": true,
"order": [[6, "desc"]],
"columnDefs": [
{className: "text-right", "targets": [2, 3, 4, 5]}
],
"ajax": {
"url": "/dt",
"data": function (d) {
d.loanRef = loanRef;
}
},
"fnRowCallback": function (nRow, aData, iDisplayIndex, iDisplayIndexFull) {
var editButton = '';
// The number of columns to display in the datatable
var cols = 8;
// Th row element's ID
var id = aData[(cols - 1)];
}
});
在上面的数据函数中,我使用了相同的名称d.loanRef = loanRef,但没有创建变量loanRef,因此递归地声明了自己。
解决方案:声明一个loanRef变量,或者更好的是,使用与d.loanRef不同的名称。
其他回答
我在这里还面临着类似的细节问题 上传logo时使用下拉logo上传框
<div>
<div class="uploader greyLogoBox" id="uploader" flex="64" onclick="$('#filePhoto').click()">
<img id="imageBox" src="{{ $ctrl.companyLogoUrl }}" alt=""/>
<input type="file" name="userprofile_picture" id="filePhoto" ngf-select="$ctrl.createUploadLogoRequest()"/>
<md-icon ng-if="!$ctrl.isLogoPresent" class="upload-icon" md-font-set="material-icons">cloud_upload</md-icon>
<div ng-if="!$ctrl.isLogoPresent" class="text">Drag and drop a file here, or click to upload</div>
</div>
<script type="text/javascript">
var imageLoader = document.getElementById('filePhoto');
imageLoader.addEventListener('change', handleImage, false);
function handleImage(e) {
var reader = new FileReader();
reader.onload = function (event) {
$('.uploader img').attr('src',event.target.result);
}
reader.readAsDataURL(e.target.files[0]);
}
</script>
</div>
CSS.css
.uploader {
position:relative;
overflow:hidden;
height:100px;
max-width: 75%;
margin: auto;
text-align: center;
img{
max-width: 464px;
max-height: 100px;
z-index:1;
border:none;
}
.drag-drop-zone {
background: rgba(0, 0, 0, 0.04);
border: 1px solid rgba(0, 0, 0, 0.12);
padding: 32px;
}
}
.uploader img{
max-width: 464px;
max-height: 100px;
z-index:1;
border:none;
}
.greyLogoBox {
width: 100%;
background: #EBEBEB;
border: 1px solid #D7D7D7;
text-align: center;
height: 100px;
padding-top: 22px;
box-sizing: border-box;
}
#filePhoto{
position:absolute;
width:464px;
height:100px;
left:0;
top:0;
z-index:2;
opacity:0;
cursor:pointer;
}
在修正之前,我的代码是:
function handleImage(e) {
var reader = new FileReader();
reader.onload = function (event) {
onclick="$('#filePhoto').click()"
$('.uploader img').attr('src',event.target.result);
}
reader.readAsDataURL(e.target.files[0]);
}
控制台的错误:
我解决了它通过删除onclick="$('#文件照片').click()"从div标签。
检查Chrome dev工具栏控制台中的错误细节,这将为您提供调用堆栈中的函数,并指导您找到导致错误的递归。
在我的情况下,我得到这个错误的ajax调用和数据,我试图传递的变量没有定义,这是显示我这个错误,但不是描述变量没有定义。我加上定义了变量n的值。
检查是否有调用自身的函数。例如
export default class DateUtils {
static now = (): Date => {
return DateUtils.now()
}
}
在我的情况下,问题是,因为我有与父路径相同的子路径:
const routes: Routes = [
{
path: '',
component: HomeComponent,
children: [
{ path: '', redirectTo: 'home', pathMatch: 'prefix' },
{ path: 'home', loadChildren: './home.module#HomeModule' },
]
}
];
所以我不得不取消了儿童路线的路线
const routes: Routes = [
{
path: '',
component: HomeComponent,
children: [
{ path: 'home', loadChildren: './home.module#HomeModule' },
]
}
];