[英]Safari browser not running my code properly?
我有以下課程:
class Portal {
caption = "";
thumbnailURL = "";
profileImgURL = "";
mp3 = "";
timestamp = 0.0;
username = "";
uid = "";
num = 0;
// var caption = new String();
// var caption = "";
// var thumbnailURL = "";
// var profileImgURL = "";
constructor(cap, thumb, prof, mp3, timestamp, username, uid) {
this.caption = cap;
this.thumbnailURL = thumb;
this.profileImgURL = prof;
this.mp3 = mp3;
this.timestamp = timestamp;
this.username = username;
this.uid = uid;
}
}
當我在 safari brower 上運行它時,我收到了兩個波紋管錯誤。
語法錯誤:意外標記“=”。 在方法的參數列表之前需要一個開頭的 '('。
然后盡管在 main.js 腳本之前運行了門戶類的腳本,我還是得到了這個:
未處理的承諾拒絕:ReferenceError:找不到變量:門戶
我該如何解決?
類字段聲明尚未最終確定,因此我認為 Safari 尚不支持它們。 – VLAZ 3 分鍾前
所需要的只是:
class Portal {
constructor(cap, thumb, prof, mp3, timestamp, username, uid) {
this.caption = cap;
this.thumbnailURL = thumb;
this.profileImgURL = prof;
this.mp3 = mp3;
this.timestamp = timestamp;
this.username = username;
this.uid = uid;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.