1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-02 08:48:37 +09:00

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

View File

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