Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带有列表的Nativescript/Angular/Javascript错误_Javascript_Arrays_List_Nativescript - Fatal编程技术网

带有列表的Nativescript/Angular/Javascript错误

带有列表的Nativescript/Angular/Javascript错误,javascript,arrays,list,nativescript,Javascript,Arrays,List,Nativescript,所以基本上我只是设置一个简单的锻炼应用程序,当我试图打印出我存储的列表中的信息列表时。这是按下提交设置按钮时运行的功能&提升类。我只是把它存储在电梯列表中 recordSet() { if (this.sets >= this.count) { this.liftList.push( new lift(this.count, this.reps, this.weight, this.rpe) ); } if (

所以基本上我只是设置一个简单的锻炼应用程序,当我试图打印出我存储的列表中的信息列表时。这是按下提交设置按钮时运行的功能&提升类。我只是把它存储在电梯列表中

recordSet() {
    if (this.sets >= this.count) {
        this.liftList.push(
            new lift(this.count, this.reps, this.weight, this.rpe)
        );
    }
    if (this.sets > this.count) {
        this.count++;
    } else {
        this.liftList.forEach(element => {
            console.log(element);
        });
    }
}

export class lift {
    name: string = "lift";
    set: number;
    reps: number;
    weight: number;
    rpe: number;
    constructor(set: number, reps: number, weight: number, rpe: number) {
        this.set = set;
        this.reps = reps;
        this.weight = weight;
        this.rpe = rpe;
    }
}

当我打印出来时,其中一些总是打印出正确的数字,但是列表元素完全搞乱了。然后这就是一些元素的显示方式(它们的关闭方式似乎并不一致,但这只是一个示例)。我不确定是什么原因造成的。似乎电梯的某些部分被推到了一个元素之外或下一个元素中。

您在本地使用游乐场或建筑应用程序吗?我在使用游乐场(终端中的tns预览命令),游乐场中的日志可能很混乱,因为它是通过网络发送的,所以日志的顺序可能会有所不同。好吧,那么我能做些什么,或者只是在本地构建,这是我唯一的选择吗?在我看来,这没什么大不了的,当只有同时/多行日志语句时,这种情况才会发生。无论如何,如果你想发布,你最终必须在本地构建应用程序。因此,如果您希望实时查看日志,您可以开始在本地构建它。