docs: 添加示例注释以说明全局组件的命名规则

This commit is contained in:
2025-12-22 05:46:52 +07:00
parent 6d9b6b0a1b
commit e9488a0234

View File

@@ -2,6 +2,11 @@ import type { App, Component } from "vue";
const modules: Record<string, { default: Component }> = import.meta.glob("./*/*.vue", { eager: true }); const modules: Record<string, { default: Component }> = import.meta.glob("./*/*.vue", { eager: true });
/**
* @example /avatar/index.vue => UiAvatar
* @example /tabs/index.vue => UiTabs
* @example /tabs/tab-pane.vue => UiTabPane
*/
function setupUiGlobalComponents(app: App) { function setupUiGlobalComponents(app: App) {
for (const path in modules) { for (const path in modules) {
const parts = path.replace(/^\.\//, "").replace(/\.vue$/, "").split("/"); const parts = path.replace(/^\.\//, "").replace(/\.vue$/, "").split("/");