- 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.
推薦閱讀
- Learn Blockchain Programming with JavaScript
- Interactive Data Visualization with Python
- Visual Basic程序設(shè)計(jì)教程
- Xcode 7 Essentials(Second Edition)
- FFmpeg入門詳解:音視頻流媒體播放器原理及應(yīng)用
- Scala謎題
- Ext JS 4 Web Application Development Cookbook
- Hands-On Functional Programming with TypeScript
- 響應(yīng)式Web設(shè)計(jì):HTML5和CSS3實(shí)戰(zhàn)(第2版)
- Getting Started with Nano Server
- 鴻蒙OS應(yīng)用編程實(shí)戰(zhàn)
- 數(shù)據(jù)分析與挖掘算法:Python實(shí)戰(zhàn)
- Python機(jī)器學(xué)習(xí)與量化投資
- Laravel Design Patterns and Best Practices
- Android項(xiàng)目實(shí)戰(zhàn):博學(xué)谷