Convert About.vue to vue class component with TypeScript

This commit is contained in:
kPherox 2019-04-09 00:33:51 +09:00
parent 1893d16c69
commit c0bd96be4b
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D
2 changed files with 49 additions and 20 deletions

View File

@ -12,9 +12,9 @@
</p>
</div>
<dl class="version">
<template v-for="(name, idx) in versionInfo">
<dt :key="'title-'+idx">{{ versionName[name] }}</dt>
<dd :key="'desc-'+idx">{{ name !== "codeName" ? versions[name] : codeName }}</dd>
<template v-for="(version, i) in versions">
<dt :key="'name-'+i">{{ version.name }}</dt>
<dd :key="'ver-'+i">{{ version.version }}</dd>
</template>
</dl>
<div id="copyright">
@ -64,22 +64,51 @@ dl.version {
}
</style>
<script>
import { remote } from 'electron'
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { ipcRenderer } from 'electron'
export default {
name: 'about',
data() {
return Object.assign({
versionName: {
codeName: "Code Name",
internal: "Internal Version",
chrome: "Chromium",
electron: "Electron",
node: "Node.js",
interface Version {
name: string
version: string
}
@Component
export default class About extends Vue {
public productName: string
public homePage: string
public copyright: string
public versions: Version[]
constructor() {
super()
let { productName, homePage, copyright, codeName, versions } = ipcRenderer.sendSync('thedesk-info')
console.log(versions)
this.productName = productName
this.homePage = homePage
this.copyright = copyright
this.versions = [
{
name: "Code Name",
version: codeName,
},
versionInfo: [ "codeName", "internal", "chrome", "electron", "node" ]
}, JSON.parse(remote.getGlobal('TheDeskInfo')))
},
{
name: "Internal Version",
version: versions.internal,
},
{
name: "Chromium",
version: versions.chrome,
},
{
name: "Electron",
version: versions.electron,
},
{
name: "Node.js",
version: versions.node,
},
]
}
}
</script>

View File

@ -5,12 +5,12 @@ const { appId, copyright } = require("./info.json")
module.exports = {
pages: {
index: {
entry: 'src/index/main.js',
entry: 'src/index/main.ts',
template: 'public/index.html',
title: productName,
},
about: {
entry: 'src/about/main.js',
entry: 'src/about/main.ts',
template: 'public/index.html',
title: `About`,
},