私は にとても慣れていませんvue.js
。
webpack で単一ファイル コンポーネントを使用してい{{operating.totaloperating}}
ますoperating
。どうやってやるの?小道具として渡そうとすると、未定義と表示されます。
このコンポーネントにはテンプレートからのみ小道具を渡すことができますが、ファイル自体では渡すことができません。
<template>
<tr v-for="operating in operatings" :operating="operating">
<th scope="row">{{$index+1}}</th>
<td>{{operating.name}}</td>
<td>-</td>
<td>{{operating.totaloperating}}</td>
</tr>
</template>
<script>
export default {
props: ['operating'],
data: function () {
return {
preloader: true,
operatings: []
}
},
methods: {
fetchTotal: function () {
this.$http.get('/api/totaloperating').then((response) => {
this.$set('operatings', response.json()),
});
}
},
ready: function () {
this.fetchTotal()
}
}
</script>