mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-22 14:01:47 +08:00
fix: player will play/pause when user are typing in search box
This commit is contained in:
parent
d9763b9528
commit
c82f30480a
|
@ -57,7 +57,6 @@
|
|||
"vue": "^2.6.11",
|
||||
"vue-analytics": "^5.22.1",
|
||||
"vue-electron": "^1.0.6",
|
||||
"vue-global-events": "^1.2.1",
|
||||
"vue-i18n": "^8.22.0",
|
||||
"vue-router": "^3.4.3",
|
||||
"vue-slider-component": "^3.2.5",
|
||||
|
|
26
src/App.vue
26
src/App.vue
|
@ -18,7 +18,6 @@
|
|||
"
|
||||
/></transition>
|
||||
<Toast />
|
||||
<GlobalEvents :filter="globalEventFilter" @keydown.space="play" />
|
||||
<ModalAddTrackToPlaylist />
|
||||
<ModalNewPlaylist />
|
||||
</div>
|
||||
|
@ -30,7 +29,6 @@ import ModalNewPlaylist from "./components/ModalNewPlaylist.vue";
|
|||
import Navbar from "./components/Navbar.vue";
|
||||
import Player from "./components/Player.vue";
|
||||
import Toast from "./components/Toast.vue";
|
||||
import GlobalEvents from "vue-global-events";
|
||||
import { ipcRenderer } from "./electron/ipcRenderer";
|
||||
|
||||
export default {
|
||||
|
@ -38,7 +36,6 @@ export default {
|
|||
components: {
|
||||
Navbar,
|
||||
Player,
|
||||
GlobalEvents,
|
||||
Toast,
|
||||
ModalAddTrackToPlaylist,
|
||||
ModalNewPlaylist,
|
||||
|
@ -52,16 +49,16 @@ export default {
|
|||
if (this.isElectron) {
|
||||
ipcRenderer(this);
|
||||
}
|
||||
window.addEventListener("keydown", this.handleKeydown);
|
||||
},
|
||||
methods: {
|
||||
play(e) {
|
||||
e.preventDefault();
|
||||
this.$refs.player.play();
|
||||
},
|
||||
globalEventFilter(event) {
|
||||
if (event.target.tagName === "INPUT") return false;
|
||||
if (this.$route.name === "mv") return false;
|
||||
return true;
|
||||
handleKeydown(e) {
|
||||
if (e.code === "Space") {
|
||||
if (e.target.tagName === "INPUT") return false;
|
||||
if (this.$route.name === "mv") return false;
|
||||
e.preventDefault();
|
||||
this.$refs.player.play();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -96,11 +93,14 @@ export default {
|
|||
}
|
||||
|
||||
#app {
|
||||
width: 100%;
|
||||
transition: all 0.4s;
|
||||
}
|
||||
#app,
|
||||
input {
|
||||
font-family: "Barlow", -apple-system, BlinkMacSystemFont, Helvetica Neue,
|
||||
PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC,
|
||||
WenQuanYi Micro Hei, sans-serif;
|
||||
width: 100%;
|
||||
transition: all 0.4s;
|
||||
}
|
||||
body {
|
||||
background-color: var(--color-body-bg);
|
||||
|
|
|
@ -69,7 +69,6 @@ export function createMenu(win) {
|
|||
submenu: [
|
||||
{
|
||||
label: "Play",
|
||||
accelerator: "Space",
|
||||
click: () => {
|
||||
win.webContents.send("play");
|
||||
},
|
||||
|
|
|
@ -11094,11 +11094,6 @@ vue-eslint-parser@^7.0.0:
|
|||
esquery "^1.0.1"
|
||||
lodash "^4.17.15"
|
||||
|
||||
vue-global-events@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/vue-global-events/-/vue-global-events-1.2.1.tgz#4c1398a1f67854c73290f5c1cedb5109116c2b50"
|
||||
integrity sha512-035Su/+5GUFnj9potJThJXu9DnayRKSENbuBw5k5sMa6hetiY+6Yu+5zUtPXT4X0S9y8tX7uSxGZJMMYiqhFfg==
|
||||
|
||||
vue-hot-reload-api@^2.3.0:
|
||||
version "2.3.4"
|
||||
resolved "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz?cache=0&sync_timestamp=1589682714858&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-hot-reload-api%2Fdownload%2Fvue-hot-reload-api-2.3.4.tgz#532955cc1eb208a3d990b3a9f9a70574657e08f2"
|
||||
|
|
Loading…
Reference in New Issue
Block a user