File tree Expand file tree Collapse file tree 4 files changed +27
-24
lines changed
packages/module-loader-typing Expand file tree Collapse file tree 4 files changed +27
-24
lines changed Original file line number Diff line number Diff line change 11# @vue-async/module-loader-type
22
3- ### TypeScript definitions for @vue-async/module-loader but using in the child modules
3+ ### TypeScript definitions for @vue-async/module-loader but using in the child module
44
Original file line number Diff line number Diff line change 1- import { Component as VueComponent , AsyncComponent } from 'vue' ;
2- import { Framework , ModuleLoaderOptions } from './module' ;
1+ import './vue' ;
32
4- declare module 'vue/types/vue' {
5- interface Vue {
6- $moduleLoadManager : Framework & ModuleLoaderOptions ;
7- $dynamicComponent : {
8- add : (
9- component : VueComponent | AsyncComponent | ( { component : VueComponent | AsyncComponent } & Record < string , any > ) ,
10- position ?: string ,
11- ) => void ;
12- remove : ( name : string , position ?: string ) => void ;
13- } ;
14- $eventBus : {
15- emit : ( eventName : string , playload : any ) => void ;
16- on : ( eventName : string , handler : ( playload : any ) => void ) => void ;
17- off : ( eventName : string , handler : ( playload : any ) => void ) => void ;
18- clear : ( ) => void ;
19- getEvents : ( ) => Record < string , any > ;
20- } ;
21- }
22- }
3+ export { Framework , DynamicComponent } from './module' ;
Original file line number Diff line number Diff line change 11import { Component as VueComponent , AsyncComponent } from 'vue' ;
22import { RouteConfig } from 'vue-router' ;
33
4- export type ModuleLoaderOptions = Omit < Record < string , any > , 'layouts' > ;
4+ export type DynamicComponent =
5+ | VueComponent
6+ | AsyncComponent
7+ | ( { component : VueComponent | AsyncComponent ; name ?: string } & Record < string , any > ) ;
58
69export interface Framework {
7- layouts : Record < string , VueComponent | AsyncComponent > ;
10+ readonly layouts : Record < string , VueComponent | AsyncComponent > ;
811 addRouters : ( routes : RouteConfig [ ] ) => void ; // 可以被重写
912 addLayouts : ( name : string , layout : VueComponent ) => void ; // 可以被重写
1013}
Original file line number Diff line number Diff line change 1+ import { Framework , DynamicComponent } from './module' ;
2+
3+ declare module 'vue/types/vue' {
4+ interface Vue {
5+ // @ts -ignore
6+ $moduleLoadManager : Framework & Record < string , any > ;
7+ $dynamicComponent : {
8+ add : ( component : DynamicComponent , position ?: string ) => void ;
9+ remove : ( name : string , position ?: string ) => void ;
10+ } ;
11+ $eventBus : {
12+ emit : ( eventName : string , playload : any ) => void ;
13+ on : ( eventName : string , handler : ( playload : any ) => void ) => void ;
14+ off : ( eventName : string , handler : ( playload : any ) => void ) => void ;
15+ clear : ( ) => void ;
16+ getEvents : ( ) => Record < string , any > ;
17+ } ;
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments