2

I want to define vue component props with in a single object in typescript.

import {Component, Prop, Vue} from 'vue-property-decorator'

export class Props extends Vue
{
  classElement :string
}

@Component
export default class Menu extends Vue<Props>
{
    public props :Props;

    .....
}

I can do this like above in class based component.

But how can I do this in component using Vue.extend()?

1 Answer 1

1

Try this syntax

props: {
  foo: {
    type: Object as () => IFoo
  }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.