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

View File

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