vue2/examples/grid/index.html

55 lines
1.3 KiB
HTML
Raw Normal View History

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>
2015-08-25 12:30:01 +08:00
<th v-for="key in columns"
on-click="sortBy(key)"
bind-class="{active: sortKey == key}">
2014-09-24 12:35:06 +08:00
{{key | capitalize}}
<span class="arrow"
bind-class="reversed[key] ? 'dsc' : 'asc'">
2014-09-24 12:35:06 +08:00
</span>
</th>
</tr>
</thead>
<tbody>
2015-08-25 12:30:01 +08:00
<tr v-for="
entry in data
2014-09-24 12:35:06 +08:00
| filterBy filterKey
| orderBy sortKey reversed[sortKey]">
2015-08-25 12:30:01 +08:00
<td v-for="key in columns">
2014-09-24 12:35:06 +08:00
{{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>
<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>
2015-08-25 12:30:01 +08:00
</html>