139 Star 1.7K Fork 403

maplemei / xm-select

 / 详情

requireJs 中引入报 xmSelect is not defined

已完成
创建于  
2021-08-21 14:12

该问题是怎么引起的?

requireJs 中引入报 xmSelect is not defined

重现步骤

require.config({
    paths: {
        "xmSelect": ["plugs/lay-module/xmSelect/xm-select"],
    }
});

define(["xmSelect"], function (xmSelect) {
    
})

报错信息

xmSelect is not defined

查看 xm-select 报错的源代码

"object" === ("undefined" == typeof exports ? "undefined" : _typeof(exports)) ? e.exports = t.c : "function" == typeof define && n(221) ? define(xmSelect) : window.layui && layui.define && layui.define((function (e) {e("xmSelect", t.c)}))

全局搜索了确实发现 xmSelect 变量的定义,改为以下代码就好了

"object" === ("undefined" == typeof exports ? "undefined" : _typeof(exports)) ? e.exports = t.c : "function" == typeof define && n(221) ? define(function() {return t.c}) : window.layui && layui.define && layui.define((function (e) { e("xmSelect", t.c)}))

评论 (9)

cshaptx4869 创建了任务
cshaptx4869 关联仓库设置为maplemei/xm-select
展开全部操作日志

Mismatched anonymous define() module: function() {return t.c}

出现你这个原因是因为你这直接lik引入进来的,通过layui 加载的方式进来就不会有这个问题了

此报错 +1, 遇到相同问题

参照 @cshaptx4869 的方法已解决!

隔壁的 selectInput 也有相同问题!

为什么博主还是没有改过来呢!已经处理好了

我们也遇到这个问题了

已知, 下个版本修复

maplemei 任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(7)
525233 sususoo 1689499107 1227973 zhengbingdong 1651829836 126695 zoujingli 1578918740 5507348 cshaptx4869 1617244978
JavaScript
1
https://gitee.com/maplemei/xm-select.git
git@gitee.com:maplemei/xm-select.git
maplemei
xm-select
xm-select

搜索帮助