Fix undefined error

This commit is contained in:
kPherox 2019-04-30 14:49:08 +09:00
parent 405140c8e0
commit f5d63e647a
No known key found for this signature in database
GPG Key ID: C04751C2BFA2F62D

View File

@ -1,21 +1,21 @@
<template> <template>
<div> <div>
<div> <div>
<form @submit.prevent="addTL"> <form @submit.prevent="addTL">
<label <label
v-for="(types,name) in userTimelineTypes" v-for="(types,name) in userTimelineTypes"
:key="name" :key="name"
:class="{selected: name === timelineType}" :class="{selected: name === timelineType}"
> >
<input type="radio" :value="name" v-model="timelineType"> <input type="radio" :value="name" v-model="timelineType">
{{ types }} {{ types }}
</label> </label>
<BaseButton <BaseButton
type="submit" type="submit"
class="primary fill" class="primary fill"
style="--font-size:.8em;margin-top:1em;" style="--font-size:.8em;margin-top:1em;"
>Add Column</BaseButton> >Add Column</BaseButton>
</form> </form>
</div> </div>
<div id="timelines"> <div id="timelines">
<div v-for="(value, key, index) in TL" :key="index" class="tl"> <div v-for="(value, key, index) in TL" :key="index" class="tl">
@ -56,9 +56,7 @@ export default class UserTimeline extends Vue {
public deleteListeners: [string, DeleteListener][] = [] public deleteListeners: [string, DeleteListener][] = []
public updateListeners: [string, UpdateListener][] = [] public updateListeners: [string, UpdateListener][] = []
public timelineType: string = "home" public timelineType: string = "home"
public userTimelineTypes: { public userTimelineTypes: { [key: string]: string } = {
[key: string]: string
} = {
home: "Home Timeline", home: "Home Timeline",
notify: "Notifications", notify: "Notifications",
dm: "Direct Messages", dm: "Direct Messages",
@ -68,6 +66,11 @@ export default class UserTimeline extends Vue {
localPlus: "Integrated Timeline (Local + Boost + Reply)" localPlus: "Integrated Timeline (Local + Boost + Reply)"
} }
public TL: Timelines = [] public TL: Timelines = []
//test
public pref = {
static: false
}
beforeDestroy() { beforeDestroy() {
this.updateListeners.forEach(([name, listener]) => { this.updateListeners.forEach(([name, listener]) => {
ipcRenderer.removeListener(name, listener) ipcRenderer.removeListener(name, listener)
@ -85,7 +88,7 @@ export default class UserTimeline extends Vue {
} }
public addTL() { public addTL() {
let timeline: Timeline = { let timeline: Timeline = {
name: "", name: this.username,
type: this.timelineType, type: this.timelineType,
statuses: new Map() statuses: new Map()
} }
@ -101,7 +104,7 @@ export default class UserTimeline extends Vue {
this.$forceUpdate() this.$forceUpdate()
} }
) )
ipcRenderer.send("timeline", timeline.type, timeline.name) ipcRenderer.send("timeline", timeline.name, timeline.type)
} }
public loadTL(timeline: Timeline, statuses: Status[]) { public loadTL(timeline: Timeline, statuses: Status[]) {
timeline.statuses = new Map( timeline.statuses = new Map(