0👍
el-table
is a component itself and will traverse the data you pass internally.
You have to pass an array of objects to it, so it will iterate it automatically.
Please refer to the docs for examples here
- [Vuejs]-How to make the loop (v-for) dynamic inside h (Vue.JS) function?
- [Vuejs]-Vuex store variable is used before it is filled in store with data from API
0👍
You need to this like this for example:
<template>
<div>
<el-table
:data="users"
style="width: 100%">
<el-table-column
prop="id"
label="ID"
width="180">
</el-table-column>
<el-table-column
prop="name"
label="Name"
width="180">
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
data() {
return{
users: [
{
id: 0,
name: 'Name 1'
},
{
id: 1,
name: 'Name 2'
},
{
id: 2,
name: 'Name 3'
},
{
id: 3,
name: 'Name 4'
},
],
}
},
}
</script>
- [Vuejs]-Vue wait for API call before loading data
- [Vuejs]-How to use v-if to to return true if route ends in number
Source:stackexchange.com