- 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.
推薦閱讀
- Java Web開發(fā)學(xué)習(xí)手冊
- Android應(yīng)用程序開發(fā)與典型案例
- Java面向?qū)ο筌浖_發(fā)
- 算法基礎(chǔ):打開程序設(shè)計(jì)之門
- 軟件測試工程師面試秘籍
- Mastering C# Concurrency
- Learning Laravel 4 Application Development
- Java Web開發(fā)技術(shù)教程
- Java EE 7 Development with NetBeans 8
- Backbone.js Blueprints
- QTP自動化測試進(jìn)階
- Mobile Device Exploitation Cookbook
- 智能搜索和推薦系統(tǒng):原理、算法與應(yīng)用
- C# Multithreaded and Parallel Programming
- 鴻蒙OS應(yīng)用編程實(shí)戰(zhàn)