Fix bug & some refactor

This commit is contained in:
syuilo 2018-09-07 00:52:13 +09:00
parent 4a00c13b33
commit 10232c5866
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="anltbovirfeutcigvwgmgxipejaeozxi" <div class="anltbovirfeutcigvwgmgxipejaeozxi"
:data-found="broadcasts.length != 0" :data-found="announcements && announcements.length != 0"
:data-melt="props.design == 1" :data-melt="props.design == 1"
:data-mobile="platform == 'mobile'" :data-mobile="platform == 'mobile'"
> >
@ -14,12 +14,12 @@
</svg> </svg>
</div> </div>
<p class="fetching" v-if="fetching">%i18n:@fetching%<mk-ellipsis/></p> <p class="fetching" v-if="fetching">%i18n:@fetching%<mk-ellipsis/></p>
<h1 v-if="!fetching">{{ broadcasts.length == 0 ? '%i18n:@no-broadcasts%' : broadcasts[i].title }}</h1> <h1 v-if="!fetching">{{ announcements.length == 0 ? '%i18n:@no-broadcasts%' : announcements[i].title }}</h1>
<p v-if="!fetching"> <p v-if="!fetching">
<span v-if="broadcasts.length != 0" v-html="broadcasts[i].text"></span> <span v-if="announcements.length != 0" v-html="announcements[i].text"></span>
<template v-if="broadcasts.length == 0">%i18n:@have-a-nice-day%</template> <template v-if="announcements.length == 0">%i18n:@have-a-nice-day%</template>
</p> </p>
<a v-if="broadcasts.length > 1" @click="next">%i18n:@next% &gt;&gt;</a> <a v-if="announcements.length > 1" @click="next">%i18n:@next% &gt;&gt;</a>
</div> </div>
</template> </template>
@ -36,18 +36,18 @@ export default define({
return { return {
i: 0, i: 0,
fetching: true, fetching: true,
broadcasts: [] announcements: []
}; };
}, },
mounted() { mounted() {
(this as any).os.getMeta().then(meta => { (this as any).os.getMeta().then(meta => {
this.broadcasts = meta.broadcasts; this.announcements = meta.broadcasts;
this.fetching = false; this.fetching = false;
}); });
}, },
methods: { methods: {
next() { next() {
if (this.i == this.broadcasts.length - 1) { if (this.i == this.announcements.length - 1) {
this.i = 0; this.i = 0;
} else { } else {
this.i++; this.i++;

View File

@ -33,7 +33,7 @@
<div class="announcements block"> <div class="announcements block">
<header>%fa:broadcast-tower% %i18n:@announcements%</header> <header>%fa:broadcast-tower% %i18n:@announcements%</header>
<div> <div v-if="announcements && announcements.length > 0">
<div v-for="announcement in announcements"> <div v-for="announcement in announcements">
<h1 v-html="announcement.title"></h1> <h1 v-html="announcement.title"></h1>
<div v-html="announcement.text"></div> <div v-html="announcement.text"></div>

View File

@ -34,7 +34,7 @@
<li @click="dark"><p><template v-if="$store.state.device.darkmode">%fa:moon%</template><template v-else>%fa:R moon%</template><span>%i18n:@darkmode%</span></p></li> <li @click="dark"><p><template v-if="$store.state.device.darkmode">%fa:moon%</template><template v-else>%fa:R moon%</template><span>%i18n:@darkmode%</span></p></li>
</ul> </ul>
</div> </div>
<div class="announcements" v-if="announcements.length > 0"> <div class="announcements" v-if="announcements && announcements.length > 0">
<article v-for="announcement in announcements"> <article v-for="announcement in announcements">
<span v-html="announcement.title" class="title"></span> <span v-html="announcement.title" class="title"></span>
<div v-html="announcement.text"></div> <div v-html="announcement.text"></div>