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

  • Vue.js 2.x by Example
  • Mike Street
  • 123字
  • 2021-07-02 20:00:32

Resolving JavaScript errors

As with the team-member component, you are going to experience some errors in your JavaScript console. These can be resolved by copying the filter data object and both the changeFilter and isActiveFilterSelected methods from the parent instance. We'll leave them in both the component and parent instance for now, but we'll remove the duplication later:

      Vue.component('filtering', {
template: '#filtering-template',

data() {
return {
filter: {
field: '',
query: ''
}
}
},

methods: {
isActiveFilterSelected() {
return (this.filter.field === 'isActive');
},

changeFilter(event) {
this.filter.query = '';
this.filter.field = event.target.value;
}
}
});

Running the app will show both the filters and person listing, but the filters won't update the people list as they are not communicating yet.

主站蜘蛛池模板: 靖宇县| 丹巴县| 盐津县| 林周县| 太湖县| 北碚区| 濉溪县| 永昌县| 达拉特旗| 大邑县| 湾仔区| 长治市| 肇东市| 隆昌县| 台中县| 延寿县| 伊川县| 清丰县| 邵东县| 化州市| 株洲县| 九江县| 平江县| 沛县| 磐石市| 东阳市| 色达县| 辉南县| 东乡族自治县| 建湖县| 拜城县| 东源县| 沈阳市| 米易县| 循化| 繁昌县| 泊头市| 靖边县| 衡东县| 绥中县| 富民县|