官术网_书友最值得收藏!

Creating the component

As with the team-member component, declare a new Vue.component() in your JavaScript, referencing a template ID of #filtering-template. Create a new <script> template block in your view and give it the same ID. Replace the filtering form in the view with a <filtering> custom HTML template and put the form inside your filtering-template script block.

Your view should look like the following:

      <p id="app">
<filtering></filtering>
<table>
<template v-for="inpidual in people">
<team-member v-bind:person="inpidual" v-
bind:filter="filter" v-
bind:statusfilter="isActiveFilterSelected()"> </team-member>
</template>
</table>
</p>

<script type="text/x-template" id="filtering-
template">

<form>
<label for="fiterField">
Field:
<select v-on:change="changeFilter($event)" id="filterField">
<option value="">Disable filters</option>
<option value="isActive">Active user</option>
<option value="name">Name</option>
<option value="email">Email</option>
<option value="balance">Balance</option>
<option value="registered">Date
registered</option>
</select>
</label>
<label for="filterQuery" v-show="this.filter.field
&& !isActiveFilterSelected()">
Query:
<input type="text" id="filterQuery" v-
model="filter.query">
</label>
<span v-show="isActiveFilterSelected()">
Active:
<label for="userStateActive">
Yes:
<input type="radio" v-bind:value="true" id="userStateActive" v-model="filter.query">
</label>
<label for="userStateInactive">
No:
<input type="radio" v-bind:value="false"
id="userStateInactive" v-model="filter.query">
</label>
</span>
</form>
</script>
<script type="text/x-template" id="team-member-
template">
// Team member template
</script>

And you should have the following in your JavaScript:

      Vue.component('filtering', {
template: '#filtering-template'
});
主站蜘蛛池模板: 萨迦县| 军事| 晋州市| 涿州市| 临泽县| 长岛县| 海兴县| 綦江县| 家居| 东宁县| 德庆县| 固原市| 正蓝旗| 平泉县| 江山市| 万载县| 镇平县| 仙桃市| 什邡市| 攀枝花市| 乌兰浩特市| 来安县| 巴彦县| 乌兰浩特市| 通山县| 寻乌县| 常州市| 陈巴尔虎旗| 南汇区| 乡宁县| 镇坪县| 山东省| 平湖市| 平山县| 蓬溪县| 无棣县| 江城| 湖南省| 阿城市| 营口市| 宁远县|