我正在查看此来源http://w2ui.com/web/demos/#!sidebar/sidebar-2
我可以通过以下方式添加文件夹:
$("#projectExplorer").w2sidebar({
name: "projectExplorer",
nodes: [
{ id: projectDir, text: projectName, img: "icon-folder", expanded: false, group1: true,
nodes: [
{ id: scriptsDir, text: "Scripts", img: "icon-folder", group1: true, expanded: false },
{ id: shaderDir, text: "Shaders", img: "icon-folder", group1: true, expanded: false }
]
}
]
});\
但是,当我尝试动态添加以下内容时:
w2ui.sidebar.insert(parent, null, [
{ id: currentFile, text: _files[i], img: "icon-page" }
]);
我收到错误:TypeError:无法读取未定义的属性“插入”
我不知道 w2ui.sidebar 是从哪里来的,但它在链接中上面的示例代码中有效,所以我认为它是库正在创建的一些全局变量,但显然在我的情况下它不存在导致错误,但没有线索关于现在该做什么。