chore(client): tweak rss-marquee

This commit is contained in:
syuilo 2022-06-30 23:53:58 +09:00
parent 7c7ce072c7
commit 30aa1dcdcd

View File

@ -6,7 +6,7 @@
<div class="ekmkgxbk"> <div class="ekmkgxbk">
<MkLoading v-if="fetching"/> <MkLoading v-if="fetching"/>
<div v-else class="feed"> <div v-else class="feed">
<MarqueeText :duration="widgetProps.speed" :reverse="widgetProps.reverse"> <MarqueeText :key="key" :duration="widgetProps.speed" :reverse="widgetProps.reverse">
<a v-for="item in items" class="item" :href="item.link" rel="nofollow noopener" target="_blank" :title="item.title">{{ item.title }}</a> <a v-for="item in items" class="item" :href="item.link" rel="nofollow noopener" target="_blank" :title="item.title">{{ item.title }}</a>
</MarqueeText> </MarqueeText>
</div> </div>
@ -75,12 +75,14 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
const items = ref([]); const items = ref([]);
const fetching = ref(true); const fetching = ref(true);
let key = $ref(0);
const tick = () => { const tick = () => {
fetch(`https://api.rss2json.com/v1/api.json?rss_url=${widgetProps.url}`, {}).then(res => { fetch(`https://api.rss2json.com/v1/api.json?rss_url=${widgetProps.url}`, {}).then(res => {
res.json().then(feed => { res.json().then(feed => {
items.value = feed.items; items.value = feed.items;
fetching.value = false; fetching.value = false;
key++;
}); });
}); });
}; };