fo-vue-ui 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
<script>
|
|
1
|
+
<!-- <script>
|
|
2
2
|
export default {
|
|
3
3
|
name: "ceshicomp",
|
|
4
4
|
}
|
|
5
|
-
</script>
|
|
5
|
+
</script> -->
|
|
6
6
|
|
|
7
7
|
<template>
|
|
8
8
|
<div class="ceshicomp">123</div>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script setup>
|
|
12
|
+
import { onMounted, getCurrentInstance } from "vue"
|
|
12
13
|
defineOptions({ name: "ceshicomp" })
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
const instance = getCurrentInstance()
|
|
16
|
+
console.log("组件内验证 name:", instance?.type.name) // 必输出 "ceshicomp"
|
|
17
|
+
})
|
|
13
18
|
</script>
|
|
14
19
|
|
|
15
20
|
<style scoped lang="scss">
|
package/src/components/index.ts
CHANGED
|
@@ -5,9 +5,15 @@ const components = [ceshicomp]
|
|
|
5
5
|
|
|
6
6
|
const install = (app: App) => {
|
|
7
7
|
components.forEach((component) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const compName = component.__name || component.name
|
|
9
|
+
console.log("install component", compName)
|
|
10
|
+
if (compName) {
|
|
11
|
+
app.component(compName, component)
|
|
12
|
+
} else {
|
|
13
|
+
const componentName = component.__file?.split("/").pop() || "未知组件"
|
|
14
|
+
console.warn(
|
|
15
|
+
`组件 ${componentName} 没有定义有效的 name 属性,请检查组件内的 name 定义`
|
|
16
|
+
)
|
|
11
17
|
}
|
|
12
18
|
})
|
|
13
19
|
}
|