vue-smart-table
Version:
A table with dynamic components for vue.js
55 lines (54 loc) • 1.61 kB
HTML
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>vuesmarttable</title>
<!--link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.css" /-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.3/css/bootstrap.min.css" />
<style>
.smart-table {
margin: 25px;
width: 470px;
}
td {
height: 120px;
}
.cell-url {
width: 113px;
}
.cell-name {
width: 100px;
}
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<smart-table
:header="[
{key: 'url', label: 'Picture', static: 'pokemon'},
{key: 'name', label: 'Name'},
{key: 'name+abilities', label: 'Abilities'}
]"
body-path="results"
:auto-load="true"
id-col="name"
endpoint="http://pokeapi.co/api/v2/pokemon/?limit=3"
v-cloak
>
<async-img col='url' url-path="sprites.front_default"></async-img>
<format col="name"></format>
<poke-abilities col="name+abilities"></poke-abilities>
<footer>
<button type="button" class="btn btn-primary"
v-if="meta && meta.previous"
@click="$parent.endpoint = meta.previous">Previous</button>
<button type="button" class="btn btn-primary"
v-if="meta && meta.next"
@click="$parent.endpoint = meta.next">Next</button>
</footer>
</smart-table>
</body>
</html>