首页 > 在使用seajs引用js时 有时会出现变量未定义

在使用seajs引用js时 有时会出现变量未定义

我在js文件中
require("kindeditor_4.1.4/kindeditor-all.js");
require("kindeditor_4.1.4/swfUploadPlugin.js");
require("kindeditor_4.1.4/lang/zh_CN.js");
但会出现 Uncaught ReferenceError: KindEditor is not defined 这个错 假若在页面中使用引入js文件就不会报错。这是为什么。


首先你要确保你引用的 kindeditor 符合 CMD 规范的写法,否则你只是加载了该js文件。但是并没有获得 kindeditor 对象。建议去了解 CMD 模块书写格式。

【热门文章】
【热门文章】