undefinedfix
Sign in

For the Vue document props, a Boolean value is passed in. If prop has no value, it means' true '? Has it been dealt with internally?

Alai edited in Mon, 20 Jun 2022

For Vue document props, a Boolean value is passed in. If prop has no value, it means true? Has it been dealt with internally?

If you do not pass a value, it should not be empty or undefined by default. How can it become true inside the component

Related codes

<!-- 包含该 prop 没有值的情况在内,都意味着 `true`。-->
<blog-post is-published></blog-post>
2 Replies
gisshizuku45
commented on Mon, 20 Jun 2022

The same thing

<input type="text" disabled readonly>
AIdrick
commented on Mon, 20 Jun 2022

For Boolean, adding the prop itself means true. On the other hand, if you want to set the prop to false, don't you just add the prop?

When you think that the prop will change during operation, you can respond by: prop = "var".

lock This question has been locked and the reply function has been disabled.