Commit 7be4f296 by wong.peiyi

修复过滤时正则表达试lastIndex没复位所造成的过滤不全的bug

parent 64be6ad5
...@@ -659,7 +659,7 @@ class ChooseProductPage extends Component { ...@@ -659,7 +659,7 @@ class ChooseProductPage extends Component {
if (isNotBlank(value)) { if (isNotBlank(value)) {
const reg = new RegExp(value, 'g') const reg = new RegExp(value, 'g')
list = R.filter(item => { list = R.filter(item => {
return reg.test(item[filter.field]) return R.test(reg, item[filter.field])
}, list) }, list)
} }
}))(filterData) }))(filterData)
...@@ -675,7 +675,7 @@ class ChooseProductPage extends Component { ...@@ -675,7 +675,7 @@ class ChooseProductPage extends Component {
const {searchValue} = this.state const {searchValue} = this.state
const includes = item => { const includes = item => {
const reg = new RegExp(searchValue, 'g') const reg = new RegExp(searchValue, 'g')
return reg.test(item.general_name) || reg.test(item.item_name) return R.test(reg, item.general_name) || R.test(reg, item.item_name)
} }
return R.filter(includes, list) return R.filter(includes, list)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment