This commit is contained in:
syuilo 2018-02-22 23:53:07 +09:00
parent e98626dbbc
commit b5068aae05
14 changed files with 102 additions and 126 deletions

View file

@ -67,6 +67,16 @@ export default class MiOS extends EventEmitter {
private isMetaFetching = false;
public app: Vue;
public new(vm, props) {
const w = new vm({
parent: this.app,
propsData: props
}).$mount();
document.body.appendChild(w.$el);
}
/**
* A signing user
*/

View file

@ -376,11 +376,9 @@ export default Vue.extend({
},
newWindow(folder) {
document.body.appendChild(new MkDriveWindow({
propsData: {
folder: folder
}
}).$mount().$el);
(this as any).os.new(MkDriveWindow, {
folder: folder
});
},
move(target) {

View file

@ -39,11 +39,9 @@ export default Vue.extend({
},
onClick() {
document.body.appendChild(new MkImagesImageDialog({
propsData: {
image: this.image
}
}).$mount().$el);
(this as any).os.new(MkImagesImageDialog, {
image: this.image
});
}
}
});

View file

@ -12,11 +12,9 @@ import MkMessagingRoomWindow from './messaging-room-window.vue';
export default Vue.extend({
methods: {
navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({
propsData: {
user: user
}
}).$mount().$el);
(this as any).os.new(MkMessagingRoomWindow, {
user: user
});
}
}
});

View file

@ -148,34 +148,26 @@ export default Vue.extend({
});
},
reply() {
document.body.appendChild(new MkPostFormWindow({
propsData: {
reply: this.p
}
}).$mount().$el);
(this as any).os.new(MkPostFormWindow, {
reply: this.p
});
},
repost() {
document.body.appendChild(new MkRepostFormWindow({
propsData: {
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkRepostFormWindow, {
post: this.p
});
},
react() {
document.body.appendChild(new MkReactionPicker({
propsData: {
source: this.$refs.reactButton,
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
source: this.$refs.menuButton,
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p
});
}
}
});

View file

@ -186,34 +186,26 @@ export default Vue.extend({
}
},
reply() {
document.body.appendChild(new MkPostFormWindow({
propsData: {
reply: this.p
}
}).$mount().$el);
(this as any).os.new(MkPostFormWindow, {
reply: this.p
});
},
repost() {
document.body.appendChild(new MkRepostFormWindow({
propsData: {
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkRepostFormWindow, {
post: this.p
});
},
react() {
document.body.appendChild(new MkReactionPicker({
propsData: {
source: this.$refs.reactButton,
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
source: this.$refs.menuButton,
post: this.p
}
}).$mount().$el);
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p
});
},
onKeydown(e) {
let shouldBeCancel = true;

View file

@ -70,11 +70,11 @@ export default Vue.extend({
},
drive() {
this.close();
document.body.appendChild(new MkDriveWindow().$mount().$el);
(this as any).os.new(MkDriveWindow);
},
settings() {
this.close();
document.body.appendChild(new MkSettingsWindow().$mount().$el);
(this as any).os.new(MkSettingsWindow);
}
}
});

View file

@ -79,7 +79,7 @@ export default Vue.extend({
},
messaging() {
document.body.appendChild(new MkMessagingWindow().$mount().$el);
(this as any).os.new(MkMessagingWindow);
}
}
});

View file

@ -17,11 +17,9 @@ export default define({
}).extend({
methods: {
navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({
propsData: {
user: user
}
}).$mount().$el);
(this as any).os.new(MkMessagingRoomWindow, {
user: user
});
},
func() {
if (this.props.design == 1) {

View file

@ -36,21 +36,15 @@ export default Vue.extend({
},
methods: {
showFollowing() {
document.body.appendChild(new MkFollowingWindow({
parent: this,
propsData: {
user: this.user
}
}).$mount().$el);
(this as any).os.new(MkFollowingWindow, {
user: this.user
});
},
showFollowers() {
document.body.appendChild(new MkFollowersWindow({
parent: this,
propsData: {
user: this.user
}
}).$mount().$el);
(this as any).os.new(MkFollowersWindow, {
user: this.user
});
},
mute() {

View file

@ -87,8 +87,26 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
// アプリ基底要素マウント
document.body.innerHTML = '<div id="app"></div>';
const app = new Vue({
router: new VueRouter({
mode: 'history'
}),
created() {
this.$watch('os.i', i => {
// キャッシュ更新
localStorage.setItem('me', JSON.stringify(i));
}, {
deep: true
});
},
render: createEl => createEl(App)
});
os.app = app;
const launch = (api: (os: MiOS) => API) => {
os.apis = api(os);
Vue.mixin({
data() {
return {
@ -99,20 +117,8 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
}
});
const app = new Vue({
router: new VueRouter({
mode: 'history'
}),
created() {
this.$watch('os.i', i => {
// キャッシュ更新
localStorage.setItem('me', JSON.stringify(i));
}, {
deep: true
});
},
render: createEl => createEl(App)
}).$mount('#app');
// マウント
app.$mount('#app');
return [app, os] as [Vue, MiOS];
};

View file

@ -154,22 +154,18 @@ export default Vue.extend({
});
},
react() {
document.body.appendChild(new MkReactionPicker({
propsData: {
source: this.$refs.reactButton,
post: this.p,
compact: true
}
}).$mount().$el);
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p,
compact: true
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
source: this.$refs.menuButton,
post: this.p,
compact: true
}
}).$mount().$el);
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p,
compact: true
});
}
}
});

View file

@ -169,22 +169,18 @@ export default Vue.extend({
});
},
react() {
document.body.appendChild(new MkReactionPicker({
propsData: {
source: this.$refs.reactButton,
post: this.p,
compact: true
}
}).$mount().$el);
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p,
compact: true
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
source: this.$refs.menuButton,
post: this.p,
compact: true
}
}).$mount().$el);
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p,
compact: true
});
}
}
});

View file

@ -53,11 +53,9 @@ export default Vue.extend({
id: notification.id
});
document.body.appendChild(new MkNotify({
propsData: {
notification
}
}).$mount().$el);
(this as any).os.new(MkNotify, {
notification
});
}
}
});