vue2 computed实现
computed: {FBAAddressListComputed () {if (!this.fbaInput) return this.FBAAddressListconst lowerCaseInput = this.fbaInput.toLowerCase()return this.FBAAddressList.filter((item) => {return [item.fbaCode, item.zipCode, item.countryCode, item.state, item.city, item.address].some((field) => field && field.toLowerCase().indexOf(lowerCaseInput) !== -1)})},},
vue3 通过 watch 实现搜索
watch(fbaInput, newV => {if (fbaInput.value === '') {searchFbaList.value = FBAAddressList.valuereturn}const lowerCaseInput = fbaInput.value.toLowerCase()searchFbaList.value = FBAAddressList.value.filter(item => {return [item.fbaCode, item.zipCode, item.countryCode, item.state, item.city, item.address].some(field => field && field.toLowerCase().indexOf(lowerCaseInput) !== -1)})})