-
Notifications
You must be signed in to change notification settings - Fork 433
How to write code of components inside component? #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi, please use the the official forum or community chat to ask usage questions. The issue list of this repo is exclusively for bug reports and feature requests. Thanks! |
I've posted here, nobody reply. I'm wondering is this a bug? Or, what's the correct usage? Maybe it should be described on README.md
|
https://github.com/vuejs/vue-class-component/blob/master/README.md#usage
@Component({
components: { MyList, MyForm }
})
class MainPage extends Vue {} |
@ktsn I get an error [ts]
Argument of type '{ components: { SwPhoneNumber: Vue; SwSvgIcon: Vue; }; }' is not assignable to parameter of type 'VueClass<Vue>'.
Object literal may only specify known properties, but 'components' does not exist in type 'VueClass<Vue>'. Did you mean to write 'component'?
(property) ComponentOptions<V, DefaultData<V>, DefaultMethods<V>, DefaultComputed, PropsDefinition<Record<string, any>>, Record<string, any>>.components: {
[key: string]: VueConstructor<Vue> | FunctionalComponentOptions<any, string[] | {
[x: string]: PropOptions<any> | (() => any) | (new (...args: any[]) => any) | ((() => any) | (new (...args: any[]) => any))[];
}> | ComponentOptions<never, any, any, any, any, Record<string, any>> | ((resolve: (component: VueConstructor<Vue> | FunctionalComponentOptions<any, string[] | {
[x: string]: PropOptions<any> | (() => any) | (new (...args: any[]) => any) | ((() => any) | (new (...args: any[]) => any))[];
}> | ComponentOptions<never, any, any, any, any, Record<string, any>>) => void, reject: (reason?: any) => void) => void | Promise<VueConstructor<Vue> | FunctionalComponentOptions<Record<string, any>, string[] | {
[x: string]: PropOptions<any> | (() => any) | (new (...args: any[]) => any) | ((() => any) | (new (...args: any[]) => any))[];
}> | ComponentOptions<never, object | ((this: never) => object), {
[key: string]: (this: never, ...args: any[]) => any;
}, {
[key: string]: any;
}, Record<string, any>, Record<string, any>> | EsModuleComponent>);
} | undefined for this code import SwPhoneNumber from '~/components/SwPhoneNumber/SwPhoneNumber.vue'
import SwSvgIcon from '~/components/SwSvgIcon/SwSvgIcon.vue'
@Component({
components: {
SwPhoneNumber,
SwSvgIcon
}
})
export default class SwFooter extends Vue {
...
} What am I doing wrong? |
@ktsn Sorry, I solved the problem. #123 (comment) |
I've a vue file like following, named as 'MainPage.vue', how to convert it into class component?
The text was updated successfully, but these errors were encountered: