完成单曲搜索,其他pr

This commit is contained in:
zilong
2021-11-01 14:44:47 +08:00
parent 82e56c3d51
commit e16176d6ea
8 changed files with 105 additions and 36 deletions

View File

@@ -5,7 +5,7 @@ export default createStore({
// appVersion: "0.0.1",
// debugStr: "测试debug字符",
showSongDetail: false, //是否显示歌曲详情
keywords: '', //查询关键字
keywords: "", //查询关键字
settings: {
currentRoute: "/discover/recommend", //当前路由
songId: 0, //歌曲id
@@ -125,6 +125,25 @@ export default createStore({
saveLoaclSettings(state.settings);
}
},
// 搜索历史
addSearchHistory(state, history) {
let h = state.settings.searchHistory.filter(
(item) => item != history
);
h.unshift(history);
state.settings.searchHistory = h;
saveLoaclSettings(state.settings);
},
removeSearchHistory(state, history) {
state.settings.searchHistory = state.settings.searchHistory.filter(
(item) => item != history
);
saveLoaclSettings(state.settings);
},
clearSearchHistory(state) {
state.settings.searchHistory = []
saveLoaclSettings(state.settings);
},
},
actions: {},
modules: {},