2014-09-24 12:35:06 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<title>Vue.js grid component example</title>
|
|
|
|
<link rel="stylesheet" href="style.css">
|
|
|
|
<script src="../../dist/vue.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<!-- component template -->
|
|
|
|
<script type="text/x-template" id="grid-template">
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th v-repeat="key: columns"
|
|
|
|
v-on="click:sortBy(key)"
|
|
|
|
v-class="active: sortKey == key">
|
|
|
|
{{key | capitalize}}
|
|
|
|
<span class="arrow"
|
|
|
|
v-class="reversed[key] ? 'dsc' : 'asc'">
|
|
|
|
</span>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr v-repeat="
|
|
|
|
entry: data
|
|
|
|
| filterBy filterKey
|
|
|
|
| orderBy sortKey reversed[sortKey]">
|
|
|
|
<td v-repeat="key: columns">
|
|
|
|
{{entry[key]}}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<!-- demo root element -->
|
|
|
|
<div id="demo">
|
2014-09-26 01:27:05 +08:00
|
|
|
<form id="search">
|
|
|
|
Search <input name="query" v-model="searchQuery">
|
|
|
|
</form>
|
2014-12-06 03:26:56 +08:00
|
|
|
<demo-grid
|
|
|
|
data="{{gridData}}"
|
|
|
|
columns="{{gridColumns}}"
|
|
|
|
filter-key="{{searchQuery}}">
|
|
|
|
</demo-grid>
|
2014-09-24 12:35:06 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="grid.js"></script>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|