2020年3月28日土曜日

Vue.js記法:v-forの追記

v-forに固定数値の利用

<div> <span v-for="n in 10">{{ n }} </span> </div>

v-forに関数の利用

<li v-for="n in even(numbers)">{{ n }}</li>
data: { numbers: [ 1, 2, 3, 4, 5 ] }, methods: { even: function (numbers) { return numbers.filter(function (number) { return number % 2 === 0 }) } }

 <template>にv-for

<ul> <template v-for="item in items"> <li>{{ item.msg }}</li> <li class="divider" role="presentation"></li> </template> </ul>

0 件のコメント:

コメントを投稿

ITIL4 Foundation Study Guide 2 : 4 Dimensions and 6 Factors

4  Dimensions:  Dimension1: Organizations & People Dimension2: Information & Technology Dimension3: Partners & Suppliers D...