Does it mean that all props of a child component must be passed with a colon `:` when the parent component is a parent?

is it true that all props of a child component must be passed : with a colon at the time of the parent component?

in subcomponents:

props: {
  a: {
    xxx
  },
  b: {
    xxx
  }
}

when using subcomponents:

<sub-comp :a="xxx" :b="xxx" />

when using child components, you must use colons to pass : ?

< hr >

Edit

when using iView"s Switch:

<Switch value="true" @on-change="on_change">

</Switch>

you can"t do this by passing value= "true" here. You must use : value=true .

Mar.03,2021

No, if you want to pass a string (the contents of double quotes), do not add a colon


of course, the data passed can be an ordinary string, that is, the data that will not change, directly write the attribute name = ", this does not need:. Instead: bind the passed data to a variable of the parent component, and the data obtained by the child component will change when the data of the parent component changes, but if it is not the binding used, the data will not change at any time. So the official document is divided into prop transfer data and dynamic prop.

Menu