refactor: use flat options on class
This commit is contained in:
@@ -9,6 +9,16 @@ interface ProviderProps {
|
||||
}
|
||||
|
||||
export class Provide extends Component<ProviderProps> {
|
||||
static props = {
|
||||
id: {
|
||||
type: [String, Symbol],
|
||||
required: true
|
||||
},
|
||||
value: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
|
||||
updateValue() {
|
||||
// TS doesn't allow symbol as index :/
|
||||
// https://github.com/Microsoft/TypeScript/issues/24587
|
||||
@@ -43,18 +53,6 @@ export class Provide extends Component<ProviderProps> {
|
||||
}
|
||||
}
|
||||
|
||||
Provide.options = {
|
||||
props: {
|
||||
id: {
|
||||
type: [String, Symbol],
|
||||
required: true
|
||||
},
|
||||
value: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Inject extends Component {
|
||||
render(props: any, slots: any) {
|
||||
return slots.default && slots.default(contextStore[props.id])
|
||||
|
||||
@@ -114,7 +114,7 @@ export class KeepAlive extends Component<KeepAliveProps> {
|
||||
;(KeepAlive as any)[KeepAliveSymbol] = true
|
||||
|
||||
function getName(comp: ComponentClass): string | void {
|
||||
return comp.options && comp.options.name
|
||||
return comp.displayName || comp.name
|
||||
}
|
||||
|
||||
function matches(pattern: MatchPattern, name: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user