WIP: Switch Main/Welcome component

This commit is contained in:
kPherox 2019-04-27 04:28:19 +09:00
parent 69e5fb3f1b
commit 4094a32ab2
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
3 changed files with 32 additions and 2 deletions

20
src/components/Main.vue Normal file
View File

@ -0,0 +1,20 @@
<template>
<div id="main">
<!-- 仮置き -->
<p>Main View</p>
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'
@Component({
components: {
}
})
export default class Main extends Vue {
}
</script>
<style lang="postcss">
</style>

View File

@ -1,21 +1,26 @@
<template> <template>
<div id="app" :style="styles"> <div id="app" :style="styles">
<Welcome/> <Welcome v-if="isStartup"/>
<Main v-else/>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { ipcRenderer } from 'electron' import { ipcRenderer } from 'electron'
import { Component, Vue } from 'vue-property-decorator' import { Component, Vue } from 'vue-property-decorator'
import Main from '@/components/Main.vue'
import Welcome from '@/components/Welcome.vue' import Welcome from '@/components/Welcome.vue'
@Component({ @Component({
components: { components: {
Main,
Welcome, Welcome,
}, },
}) })
export default class App extends Vue { export default class App extends Vue {
public isDarkMode!: boolean public isDarkMode!: boolean
public isStartup!: boolean
public fontSize!: string public fontSize!: string
public get styles(): { [key: string]: string } { public get styles(): { [key: string]: string } {
@ -28,11 +33,16 @@ export default class App extends Vue {
created() { created() {
this.isDarkMode = ipcRenderer.sendSync('dark-theme') this.isDarkMode = ipcRenderer.sendSync('dark-theme')
this.isStartup = true // TODO: ipcboolean
this.fontSize = '16px' this.fontSize = '16px'
} }
mounted() { mounted() {
ipcRenderer.on('change-color-theme', () => this.isDarkMode = ipcRenderer.sendSync('dark-theme')) ipcRenderer.on('change-color-theme', () => this.isDarkMode = ipcRenderer.sendSync('dark-theme'))
// TODO: TL
if (this.isStartup) {
//ipcRenderer.once('add-account-or-timeline', () => this.isStartup = false)
}
} }
beforeDestroy() { beforeDestroy() {