テンプレート内には、次の要素があります。
<template>
<div>
<span v-for="item in items">{{item.name}}</span>
</div>
</template>
私のスクリプトには次のものがあります。
import axios from 'axios';
export default {
data: () => ({ items: null }),
mounted: function () {
var vm = this;
axios.get('/items')
.then(function (response) {
vm.items = response.data;
});
}
}
私の質問は、<span>要素を表示する方法と、応答が?v-forのリストで返されたら実行する方法です。items