Improve RSS widget

This commit is contained in:
syuilo 2018-05-28 15:06:32 +09:00
parent f0c031ecdb
commit 95e5800b36
1 changed files with 6 additions and 4 deletions

View File

@ -19,12 +19,12 @@ import define from '../../../common/define-widget';
export default define({ export default define({
name: 'rss', name: 'rss',
props: () => ({ props: () => ({
compact: false compact: false,
url: 'http://news.yahoo.co.jp/pickup/rss.xml'
}) })
}).extend({ }).extend({
data() { data() {
return { return {
url: 'http://news.yahoo.co.jp/pickup/rss.xml',
items: [], items: [],
fetching: true, fetching: true,
clock: null clock: null
@ -43,7 +43,7 @@ export default define({
this.save(); this.save();
}, },
fetch() { fetch() {
fetch(`https://api.rss2json.com/v1/api.json?rss_url=${this.url}`, { fetch(`https://api.rss2json.com/v1/api.json?rss_url=${this.props.url}`, {
cache: 'no-cache' cache: 'no-cache'
}).then(res => { }).then(res => {
res.json().then(feed => { res.json().then(feed => {
@ -53,7 +53,9 @@ export default define({
}); });
}, },
setting() { setting() {
alert('not implemented yet'); this.props.url =window.prompt('URL', this.props.url);
this.save();
this.fetch();
} }
} }
}); });