mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
fix: player will play/pause when user are typing in search box
This commit is contained in:
parent
d9763b9528
commit
c82f30480a
4 changed files with 13 additions and 20 deletions
|
|
@ -57,7 +57,6 @@
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-analytics": "^5.22.1",
|
"vue-analytics": "^5.22.1",
|
||||||
"vue-electron": "^1.0.6",
|
"vue-electron": "^1.0.6",
|
||||||
"vue-global-events": "^1.2.1",
|
|
||||||
"vue-i18n": "^8.22.0",
|
"vue-i18n": "^8.22.0",
|
||||||
"vue-router": "^3.4.3",
|
"vue-router": "^3.4.3",
|
||||||
"vue-slider-component": "^3.2.5",
|
"vue-slider-component": "^3.2.5",
|
||||||
|
|
|
||||||
26
src/App.vue
26
src/App.vue
|
|
@ -18,7 +18,6 @@
|
||||||
"
|
"
|
||||||
/></transition>
|
/></transition>
|
||||||
<Toast />
|
<Toast />
|
||||||
<GlobalEvents :filter="globalEventFilter" @keydown.space="play" />
|
|
||||||
<ModalAddTrackToPlaylist />
|
<ModalAddTrackToPlaylist />
|
||||||
<ModalNewPlaylist />
|
<ModalNewPlaylist />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -30,7 +29,6 @@ import ModalNewPlaylist from "./components/ModalNewPlaylist.vue";
|
||||||
import Navbar from "./components/Navbar.vue";
|
import Navbar from "./components/Navbar.vue";
|
||||||
import Player from "./components/Player.vue";
|
import Player from "./components/Player.vue";
|
||||||
import Toast from "./components/Toast.vue";
|
import Toast from "./components/Toast.vue";
|
||||||
import GlobalEvents from "vue-global-events";
|
|
||||||
import { ipcRenderer } from "./electron/ipcRenderer";
|
import { ipcRenderer } from "./electron/ipcRenderer";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -38,7 +36,6 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Navbar,
|
Navbar,
|
||||||
Player,
|
Player,
|
||||||
GlobalEvents,
|
|
||||||
Toast,
|
Toast,
|
||||||
ModalAddTrackToPlaylist,
|
ModalAddTrackToPlaylist,
|
||||||
ModalNewPlaylist,
|
ModalNewPlaylist,
|
||||||
|
|
@ -52,16 +49,16 @@ export default {
|
||||||
if (this.isElectron) {
|
if (this.isElectron) {
|
||||||
ipcRenderer(this);
|
ipcRenderer(this);
|
||||||
}
|
}
|
||||||
|
window.addEventListener("keydown", this.handleKeydown);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
play(e) {
|
handleKeydown(e) {
|
||||||
e.preventDefault();
|
if (e.code === "Space") {
|
||||||
this.$refs.player.play();
|
if (e.target.tagName === "INPUT") return false;
|
||||||
},
|
if (this.$route.name === "mv") return false;
|
||||||
globalEventFilter(event) {
|
e.preventDefault();
|
||||||
if (event.target.tagName === "INPUT") return false;
|
this.$refs.player.play();
|
||||||
if (this.$route.name === "mv") return false;
|
}
|
||||||
return true;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -96,11 +93,14 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
#app {
|
#app {
|
||||||
|
width: 100%;
|
||||||
|
transition: all 0.4s;
|
||||||
|
}
|
||||||
|
#app,
|
||||||
|
input {
|
||||||
font-family: "Barlow", -apple-system, BlinkMacSystemFont, Helvetica Neue,
|
font-family: "Barlow", -apple-system, BlinkMacSystemFont, Helvetica Neue,
|
||||||
PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC,
|
PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC,
|
||||||
WenQuanYi Micro Hei, sans-serif;
|
WenQuanYi Micro Hei, sans-serif;
|
||||||
width: 100%;
|
|
||||||
transition: all 0.4s;
|
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
background-color: var(--color-body-bg);
|
background-color: var(--color-body-bg);
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ export function createMenu(win) {
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: "Play",
|
label: "Play",
|
||||||
accelerator: "Space",
|
|
||||||
click: () => {
|
click: () => {
|
||||||
win.webContents.send("play");
|
win.webContents.send("play");
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -11094,11 +11094,6 @@ vue-eslint-parser@^7.0.0:
|
||||||
esquery "^1.0.1"
|
esquery "^1.0.1"
|
||||||
lodash "^4.17.15"
|
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:
|
vue-hot-reload-api@^2.3.0:
|
||||||
version "2.3.4"
|
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"
|
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…
Add table
Add a link
Reference in a new issue