vue2server7 7.0.2 → 7.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test/11111111.tx +20 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2server7",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "dev": "nodemon --watch src --ext ts --exec \"ts-node src/app.ts\"",
package/test/11111111.tx CHANGED
@@ -1,12 +1,24 @@
1
- import type { App } from 'vue'
1
+ import type { App, Component } from 'vue'
2
2
  import NumberInput from './NumberInput.vue'
3
3
 
4
- const components = [NumberInput]
4
+ // 组件列表类型声明
5
+ const components: Component[] = [NumberInput]
5
6
 
7
+ // ✅ 插件类型
8
+ const install = (app: App): void => {
9
+ components.forEach((comp) => {
10
+ app.component(
11
+ // @ts-ignore 兼容 name 类型
12
+ comp.name as string,
13
+ comp
14
+ )
15
+ })
16
+ }
17
+
18
+ // ✅ 导出(支持 app.use)
6
19
  export default {
7
- install(app: App) {
8
- components.forEach((comp) => {
9
- app.component(comp.name || 'NumberInput', comp)
10
- })
11
- }
12
- }
20
+ install
21
+ }
22
+
23
+ // ✅ 也可以单独导出组件(可选)
24
+ export { NumberInput }