Closed aoi-umi closed 3 years ago
@aoi-umi
The better way to extend existing Component is
@Component
export class Component extends Base {}
Thanks.
@aoi-umi
The better way to extend existing Component is
@Component export class Component extends Base {}
Thanks.
i do this for the tsx prop
forexample:
interface VueComponentOptions {
ref?: any;
class?: any;
style?: { [key: string]: any };
props?: any;
slot?: string;
name?: string;
}
export function convClass<prop>(t) {
return t as {
new(props: prop & VueComponentOptions): any
};
}
//conv prop
export function getCompOpts(target) {
const Ctor = typeof target === 'function'
? target
: target.constructor;
const decorators = Ctor.__decorators__;
const options: any = {};
if (decorators) {
decorators.forEach(function (fn) { return fn(options); });
}
return options;
}
class CompProp {
@Prop({ required: true })
req: string;
@Prop({ required: false })
notReq?: string;
}
@Component({
mixins: [getCompOpts(CompProp)]
})
export class CompMain extends Vue<CompProp> {
}
export const Comp = convClass<CompProp>(CompMain);
finally i can write tsx with code hints or do u have a better way? do u know what i mean?
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior
Desktop (please complete the following information):
Additional context it work fine in
typescript 3.8.2
but error intypescript 3.9.4