在我的dash应用程序中,我使用dash_extensions.javascript函数Namespace来使用js代码。在IDE中运行时,它工作得很好。在使用cx_freeze进行构建之后,无法找到名称空间。确切的错误是:
No match for [myNamespace.mySubNamespace.function_name] in the global window object.
使用dash_extensions的dash_extensions函数和使用dash_transcrypt module_to_props()时也会出现类似的错误。
我正在使用:
dash=2.1.0dash_extensions=0.0.67dash_transcrypt=0.0.6dash_leaflet=0.1.18cx_freeze=6.10有人能复制这种行为吗?这是有意的还是我的用例不适合破折号?
发布于 2022-03-18 16:51:04
尝试在yout /assets文件夹中放置一个包含所有功能的.js文件(例如,dashExtensions.js)。
示例:
window.dashExtensions = Object.assign({}, window.dashExtensions, {
default: {
drawMarkers: function (feature, latlng, context) {
return L.circleMarker(latlng, { radius: 2 }); // sender a simple circle marker.
},
},
});然后在您的python代码中放置ns = Namespace("dashExtensions", "default")。请注意dashExtensions和默认之间的对应关系。
https://stackoverflow.com/questions/70923645
复制相似问题