1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-15 15:18:22 +09:00
This commit is contained in:
syuilo 2018-02-24 03:03:26 +09:00
parent df8a2aea35
commit cf1f2562d7
4 changed files with 34 additions and 13 deletions

View File

@ -25,7 +25,6 @@ export default function<T extends object>(data: {
}; };
}, },
created() { created() {
if (this.widget.data == null) this.widget.data = {};
if (this.props) { if (this.props) {
Object.keys(this.props).forEach(prop => { Object.keys(this.props).forEach(prop => {
if (this.widget.data.hasOwnProperty(prop)) { if (this.widget.data.hasOwnProperty(prop)) {

View File

@ -33,7 +33,7 @@ export default Vue.extend({
&.naked &.naked
background transparent !important background transparent !important
border none !important box-shadow none !important
> header > header
> .title > .title

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="mkw-activity"> <div class="mkw-activity">
<mk-widget-container> <mk-widget-container :show-header="!props.compact">
<template slot="header">%fa:chart-bar%アクティビティ</template> <template slot="header">%fa:chart-bar%アクティビティ</template>
<div :class="$style.body"> <div :class="$style.body">
<mk-activity :user="os.i"/> <mk-activity :user="os.i"/>
@ -14,6 +14,15 @@ import define from '../../../../common/define-widget';
export default define({ export default define({
name: 'activity', name: 'activity',
props: () => ({
compact: false
})
}).extend({
methods: {
func() {
this.props.compact = !this.props.compact;
}
}
}); });
</script> </script>

View File

@ -44,7 +44,7 @@
<header> <header>
<span class="handle">%fa:bars%</span>{{ widget.name }}<button class="remove" @click="removeWidget(widget)">%fa:times%</button> <span class="handle">%fa:bars%</span>{{ widget.name }}<button class="remove" @click="removeWidget(widget)">%fa:times%</button>
</header> </header>
<div> <div @click="widgetFunc(widget.id)">
<component :is="`mkw-${widget.name}`" :widget="widget" :ref="widget.id" :is-mobile="true"/> <component :is="`mkw-${widget.name}`" :widget="widget" :ref="widget.id" :is-mobile="true"/>
</div> </div>
</div> </div>
@ -84,28 +84,37 @@ export default Vue.extend({
if ((this as any).os.i.client_settings.mobile_home == null) { if ((this as any).os.i.client_settings.mobile_home == null) {
Vue.set((this as any).os.i.client_settings, 'mobile_home', [{ Vue.set((this as any).os.i.client_settings, 'mobile_home', [{
name: 'calendar', name: 'calendar',
id: 'a' id: 'a', data: {}
}, { }, {
name: 'activity', name: 'activity',
id: 'b' id: 'b', data: {}
}, { }, {
name: 'rss', name: 'rss',
id: 'c' id: 'c', data: {}
}, { }, {
name: 'photo-stream', name: 'photo-stream',
id: 'd' id: 'd', data: {}
}, { }, {
name: 'donation', name: 'donation',
id: 'e' id: 'e', data: {}
}, { }, {
name: 'nav', name: 'nav',
id: 'f' id: 'f', data: {}
}, { }, {
name: 'version', name: 'version',
id: 'g' id: 'g', data: {}
}]); }]);
}
this.widgets = (this as any).os.i.client_settings.mobile_home; this.widgets = (this as any).os.i.client_settings.mobile_home;
this.saveHome();
} else {
this.widgets = (this as any).os.i.client_settings.mobile_home;
}
this.$watch('os.i', i => {
this.widgets = (this as any).os.i.client_settings.mobile_home;
}, {
deep: true
});
}, },
mounted() { mounted() {
document.title = 'Misskey'; document.title = 'Misskey';
@ -143,6 +152,10 @@ export default Vue.extend({
document.title = 'Misskey'; document.title = 'Misskey';
} }
}, },
widgetFunc(id) {
const w = this.$refs[id][0];
if (w.func) w.func();
},
onWidgetSort() { onWidgetSort() {
this.saveHome(); this.saveHome();
}, },