1<!-- ternary operator in vuejs -->
2
3<p>{{data.text != null ? data.text : 'text = null'}}</p>
4
5<!-- Test ? if true : if false -->
1<ul id="example-1">
2 <li v-for="item in items" :key="item.message">
3 {{ item.message }}
4 </li>
5</ul>
6
7
8const example1 = new Vue({
9 el: '#example-1',
10 data: {
11 items: [
12 { message: 'Foo' },
13 { message: 'Bar' }
14 ]
15 }
16})