mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix: show toast when search failed (#789)
This commit is contained in:
parent
610f663c24
commit
daadad7bf3
1 changed files with 10 additions and 3 deletions
|
|
@ -85,6 +85,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapActions } from 'vuex';
|
||||||
import { getTrackDetail } from '@/api/track';
|
import { getTrackDetail } from '@/api/track';
|
||||||
import { search } from '@/api/others';
|
import { search } from '@/api/others';
|
||||||
import NProgress from 'nprogress';
|
import NProgress from 'nprogress';
|
||||||
|
|
@ -135,11 +136,13 @@ export default {
|
||||||
this.getData();
|
this.getData();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
...mapActions(['showToast']),
|
||||||
playTrackInSearchResult(id) {
|
playTrackInSearchResult(id) {
|
||||||
let track = this.tracks.find(t => t.id === id);
|
let track = this.tracks.find(t => t.id === id);
|
||||||
this.$store.state.player.appendTrackToPlayerList(track, true);
|
this.$store.state.player.appendTrackToPlayerList(track, true);
|
||||||
},
|
},
|
||||||
search(type = 'all') {
|
search(type = 'all') {
|
||||||
|
let showToast = this.showToast;
|
||||||
const typeTable = {
|
const typeTable = {
|
||||||
all: 1018,
|
all: 1018,
|
||||||
musicVideos: 1004,
|
musicVideos: 1004,
|
||||||
|
|
@ -152,8 +155,12 @@ export default {
|
||||||
keywords: this.keywords,
|
keywords: this.keywords,
|
||||||
type: typeTable[type],
|
type: typeTable[type],
|
||||||
limit: 16,
|
limit: 16,
|
||||||
}).then(result => {
|
})
|
||||||
|
.then(result => {
|
||||||
return { result: result.result, type };
|
return { result: result.result, type };
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
showToast(err.response.data.msg || err.response.data.message);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData() {
|
getData() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue