R
R
Roman Sarvarov2020-12-28 10:03:24
Vue.js
Roman Sarvarov, 2020-12-28 10:03:24

Declaring props in a component as an object. What if there are no requirements?

I have two props in a component - required (boolean) and data (mixed).
For required there is a check for the type and default value, for data there is none of this.
Is the way I write below the only possible way to declare props or is there a more concise way (to get rid of {})?

props: {
   data: {},
   required: {
      type: Boolean,
      default: false,
   }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-12-28
@megakor

Don't skimp on the documentation . All the answers to your question are there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question