I want to use itemList
in template. itemlist
is a static list. But I don't know where to declare it and how to export it to the template
<template>
<table >
<thead>
<tr>
<th>category</th>
<th>value</th>
</tr>
</thead>
<tbody>
<tr v-for="item in itemList" :key="item.key">
<td>{{ item.label }}</td>
<td>{{ currentBanner[item.key] }}</td>
</tr>
</tbody>
</table>
</template>
<script lang="ts">
@Component({
name: 'GroupingBannerModal',
})
export default class GroupingBannerModal extends Vue {
itemList = [
{ key: 'id', label: 'ID' },
{ key: 'source', label: 'ソース' },
{ key: 'agency', label: '代理店' },
{ key: 'media', label: '媒体' },
]
@Prop({ type: Array })
private lstBannerGrouped!: Banner[]
private currentBanner: Banner | null = null
}
</script>
CodePudding user response:
If you want to access this in your template, declare your array in either data()
, computed
or asyncData()
.