feat: scrollbar and logic update for electron

This commit is contained in:
kunkka 2020-10-31 14:03:23 +08:00
parent ae6ecd96fd
commit 3e38604119
2 changed files with 59 additions and 40 deletions

View File

@ -79,7 +79,8 @@
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
"env": { "env": {
"node": true "node": true,
"browser": true
}, },
"extends": [ "extends": [
"plugin:vue/essential", "plugin:vue/essential",
@ -88,6 +89,9 @@
"parserOptions": { "parserOptions": {
"parser": "babel-eslint" "parser": "babel-eslint"
}, },
"globals": {
"ipcRenderer": "off"
},
"rules": {} "rules": {}
}, },
"browserslist": [ "browserslist": [

View File

@ -25,8 +25,6 @@
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 GlobalEvents from "vue-global-events"; import GlobalEvents from "vue-global-events";
const electron = window.require("electron");
const ipcRenderer = electron.ipcRenderer;
export default { export default {
name: "App", name: "App",
@ -35,7 +33,18 @@ export default {
Player, Player,
GlobalEvents, GlobalEvents,
}, },
data() {
return {
isElectron: process.env.IS_ELECTRON // "true" || undefined
}
},
created() { created() {
if (this.isElectron) {
//
document.body.classList.add('is-electron')
// ipc message channel
const electron = window.require("electron");
const ipcRenderer = electron.ipcRenderer;
// listens to the main process 'changeRouteTo' event and changes the route from // listens to the main process 'changeRouteTo' event and changes the route from
// inside this Vue instance, according to what path the main process requires. // inside this Vue instance, according to what path the main process requires.
// responds to Menu click() events at the main process and changes the route accordingly. // responds to Menu click() events at the main process and changes the route accordingly.
@ -73,6 +82,7 @@ export default {
ipcRenderer.on("shuffle", () => { ipcRenderer.on("shuffle", () => {
this.$refs.player.shuffle(); this.$refs.player.shuffle();
}); });
}
}, },
methods: { methods: {
play(e) { play(e) {
@ -161,6 +171,11 @@ a {
} }
} }
// for electron
body.is-electron::-webkit-scrollbar {
width: 0;
}
/* Let's get this party started */ /* Let's get this party started */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;