Debounce dashboard user project search
This commit is contained in:
@@ -97,11 +97,17 @@ module.exports = {
|
||||
this.password = ''
|
||||
}
|
||||
},
|
||||
projectKeyword(val) {
|
||||
this.$store.dispatch('dashboard_user/search_project', { search: val || '' })
|
||||
projectKeyword(val, old) {
|
||||
let next = (val || '').trim()
|
||||
let prev = (old || '').trim()
|
||||
if (next === prev) return
|
||||
this.thrSearchProject(next)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
thrSearchProject: _.debounce(function(keyword) {
|
||||
this.$store.dispatch('dashboard_user/search_project', { search: keyword || '' })
|
||||
}, 300),
|
||||
closeDialogSuccess() {
|
||||
this.$store.commit('dashboard_user/update_dialog_success', false)
|
||||
this.refreshList()
|
||||
|
||||
@@ -72,8 +72,11 @@ module.exports = {
|
||||
projectSearch: {
|
||||
get() { return this.$store.state.dashboard_user.project_keyword },
|
||||
set(val) {
|
||||
let next = (val || '').trim()
|
||||
let prev = (this.$store.state.dashboard_user.project_keyword || '').trim()
|
||||
if (next === prev) return
|
||||
this.$store.commit('dashboard_user/update_project_keyword', val)
|
||||
this.$store.dispatch('dashboard_user/search_project', { search: val || '' })
|
||||
this.thrSearchProject(next)
|
||||
}
|
||||
},
|
||||
projectItems() {
|
||||
@@ -85,6 +88,9 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
thrSearchProject: _.debounce(function(keyword) {
|
||||
this.$store.dispatch('dashboard_user/search_project', { search: keyword || '' })
|
||||
}, 300),
|
||||
doSearch() {
|
||||
this.$store.dispatch('dashboard_user/search', {
|
||||
username: this.username || '',
|
||||
|
||||
Reference in New Issue
Block a user