Bootstrap
Customer.vue
默认页
Alert.vue
提示消息(默认页顶部)
Add.vue
添加客户页
CustomerDetails.vue
客户详情页
Edit.vue
编辑客户页面
点击“详情”按钮后,调用函数
fetchCustomers(id)
fetchCustomers(id) { this.$http.get('http://localhost:3000/users/' + id).then((res) => { this.customer = res.body }) }
Customer.vue
中,客户列表处使用 v:for 在filterBy(customers, filterInput)
函数中过滤结果filterBy(customers, filterInput) { // 对 customers 数组依次遍历,返回 name 与输入的 filterInput 匹配的数组项 return customers.filter(function(customer) { return customer.name.match(filterInput) }) }