1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

各種v-bindの書き方メモ

Last updated at Posted at 2021-10-26

触り始めたばかりで、propsを渡す時しょっちゅう書き方が忘れちゃっうから、ちょっとまとめてみようと思います

数字

<my-component :size="{{ 50 }}"><my-component>
<my-component :size={{ 50 }}><my-component>
<my-component :size=50><my-component>

数字(Number)タイプの変数

<my-component :size="{{ $size }}"><my-component>

文字列(String)

<my-component first-name="{{ $firstName }}"><my-component>

laravelのroute

<my-component path="{{ route('admin.login') }}"><my-component>

Boolean値

<my-component :disabled="false"><my-component>

Boolean変数

<my-component :disabled="{{ $disabled ? 'true' : 'false'}}"><my-component>

配列

<my-component :order-list='@json($orderList)'><my-compoent>

三項演算子

<my-component :label="{{ $total>100 ? 'green' : 'red'}}"><my-component>

null

<my-component :value="null"><my-component>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?