basic
basic copied to clipboard
views/windows目录不支持子目录吗?如果支持代码组织是不是更优
如题,文档中没看到,我试验windowName不知道如何写 比如我主菜单有很多模块,在windows目录下,想要一个模块一个目录,然后window在各个模块目录下
是的,不支持嵌套目录结构,如果要实现该特性,需要同步修改 src/views/windows/registerWindowComponent.ts 文件,该文件实现所有窗口组件的全局自动注册
export default function registerWindowComponent(app: App) {
const componentsContext = import.meta.glob('./**/index.vue')
for (const path in componentsContext) {
let name = path.replace('./', '')
console.log(name)
name = name.slice(0, name.lastIndexOf('/'))
console.log(name)
console.log(path)
app.component(name, defineAsyncComponent(componentsContext[path] as any))
}
}
好像只要把indexOf改成lastIndexOf menu中的windowName:写成'Server/Servers'这样。你们不内置支持吗?这样改不会产生别的问题吧