requirejs,dialog is not a function
gitdust opened this issue · comments
iCH4O commented
define(['jquery','artDialog'], function($,dialog) {
dialog({
title: 'message',
content: ''
}).showModal();
});
RT,报错,dialog is not a function,jquery.js(v1.11.3)、dialog.js(v6.0.5)已经确定加载
传峰 commented
同问,多一条错误:Uncaught ReferenceError: jQuery is not defined
require.config({
paths: {
jquery : '/js/library/jquery-1.10.2.min',
template: '/template/dashboard/build/template',
layout : '/js/dashboard/layout',
dialog : '/js/artDialog/dist/dialog'
}
});
require(['jquery', 'jquery', 'template', 'layout', 'dialog'], function ($, jQuery, template, layout, dialog) {});
iCH4O commented
已解决,用整个src的文件,目录自己改,config:
"paths": {
"jquery": "jquery",
"artDialog": "artDialog/dialog",
"popup": "artDialog/popup",
"dialog-config": "artDialog/dialog-config",
},
shim: {
"artDialog": {
deps: ["jquery", "popup", "dialog-config"]
}
}
@codelegant
传峰 commented
另一种解决方法:
require.config({
paths: {
jquery : '/js/library/jquery.min',
dialog : '/js/artDialog/dialog-min'
},
shim : {
dialog : {
deps : ['jquery'],
exports: 'dialog'
}
}
});
iCH4O commented
@codelegant thx