新增“离开搜索界面时清空搜索列表”设置

This commit is contained in:
lyswhut
2019-12-13 13:34:35 +08:00
parent e109dd876a
commit 207427e993
4 changed files with 21 additions and 5 deletions
+13 -4
View File
@@ -13,7 +13,7 @@
<script>
import { rendererSend } from 'common/ipc'
import { mapGetters } from 'vuex'
import { mapGetters, mapMutations } from 'vuex'
import music from '../../utils/music'
import { debounce } from '../../utils'
export default {
@@ -34,15 +34,21 @@ export default {
source() {
return this.setting.search.tempSearchSource
},
isAutoClearInput() {
isAutoClearSearchInput() {
return this.setting.odc.isAutoClearSearchInput
},
isAutoClearSearchList() {
return this.setting.odc.isAutoClearSearchList
},
},
watch: {
route(n) {
if (this.isAutoClearInput && n.name != 'search' && this.searchText) this.searchText = ''
if (n.name != 'search') {
if (this.isAutoClearSearchInput && this.searchText) this.searchText = ''
if (this.isAutoClearSearchList) this.clearSearchList()
}
},
'storeSearchText'(n) {
storeSearchText(n) {
if (n !== this.searchText) this.searchText = n
},
searchText(n) {
@@ -62,6 +68,9 @@ export default {
}, 50)
},
methods: {
...mapMutations('search', {
clearSearchList: 'clearList',
}),
handleEvent({ action, data }) {
switch (action) {
case 'focus':