第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

我收到“未捕獲參考錯(cuò)誤:時(shí)刻未定義”錯(cuò)誤。我怎樣才能解決這個(gè)問(wèn)題?

我收到“未捕獲參考錯(cuò)誤:時(shí)刻未定義”錯(cuò)誤。我怎樣才能解決這個(gè)問(wèn)題?

冉冉說(shuō) 2022-12-22 12:20:24
我在我的 laravel 項(xiàng)目中使用了這個(gè) js 代碼來(lái)獲取時(shí)刻庫(kù)。        var today = moment();        function Calendar(selector, events) {            this.el = document.querySelector(selector);            this.events = events;            this.current = moment().date(1);            this.draw();            var current = document.querySelector('.today');            if (current) {                var self = this;                window.setTimeout(function () {                    self.openDay(current);                }, 500);            }        }我在正文部分使用此腳本標(biāo)記調(diào)用了 js 文件<script src="moment.min.js"></script>現(xiàn)在得到 Uncaught ReferenceError: moment is not defined in console. moment.min.js 在同一目錄中。我該如何解決這個(gè)問(wèn)題。`
查看完整描述

2 回答

?
寶慕林4294392

TA貢獻(xiàn)2021條經(jīng)驗(yàn) 獲得超8個(gè)贊

試試這個(gè)


function loadError(oError) {

  throw new URIError("The script " + oError.target.src + " didn't load 

correctly.");

}


function affixScriptToHead(url, onloadFunction) {

  var newScript = document.createElement("script");

  newScript.onerror = loadError;

  if (onloadFunction) { newScript.onload = onloadFunction; }

  document.head.appendChild(newScript);

  newScript.src = url;

}


查看完整回答
反對(duì) 回復(fù) 2022-12-22
?
德瑪西亞99

TA貢獻(xiàn)1770條經(jīng)驗(yàn) 獲得超3個(gè)贊

這是因?yàn)?,由于腳本是異步加載的,并且在將腳本加載到瀏覽器之前,您正在嘗試訪問(wèn)這一刻。這樣做的最好方法是檢查您正在使用的庫(kù)是否已加載,您可以通過(guò)添加一些鏈接來(lái)做到這一點(diǎn)


function loadError(oError) {

  throw new URIError("The script " + oError.target.src + " didn't load correctly.");

}


function affixScriptToHead(url, onloadFunction) {

  var newScript = document.createElement("script");

  newScript.onerror = loadError;

  if (onloadFunction) { newScript.onload = onloadFunction; }

  document.head.appendChild(newScript);

  newScript.src = url;

}

在您可以參考 moment 之后參考https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement


查看完整回答
反對(duì) 回復(fù) 2022-12-22
  • 2 回答
  • 0 關(guān)注
  • 93 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)