![](/img/trans.png)
[英]How to convert for of loop into a for loop to solve the ESLint error
[英]How to solve this error JSONEditor is not defined ESlint
我有一個 JSON 編輯器,它工作正常,但 ESlint 一直給我這個錯誤
'JSONEditor' 未定義
我的代碼存在於 angularJS 1.7 組件中。
this.$onInit = function () {
var container = $document[0].getElementById('jsoneditor');
var editor = new JSONEditor(container, { mode: 'code' }, json);
// code to use the editor
};
沒有什么復雜的,只是 ESLint 對此不滿意。
ESLint 不知道您的代碼中是否存在該類。 您可以跳過它或將其從代碼中注釋掉或將其添加到異常中
我添加了這一行,它解決了問題
/* global JSONEditor */
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.