0
0
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: {
(this as any).os.new(MkDriveWindow, {
folder: folder
}
}).$mount().$el);
});
},
move(target) {

View File

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

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: {
(this as any).os.new(MkMessagingRoomWindow, {
user: user
}
}).$mount().$el);
});
}
}
});

View File

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

View File

@ -186,34 +186,26 @@ export default Vue.extend({
}
},
reply() {
document.body.appendChild(new MkPostFormWindow({
propsData: {
(this as any).os.new(MkPostFormWindow, {
reply: this.p
}
}).$mount().$el);
});
},
repost() {
document.body.appendChild(new MkRepostFormWindow({
propsData: {
(this as any).os.new(MkRepostFormWindow, {
post: this.p
}
}).$mount().$el);
});
},
react() {
document.body.appendChild(new MkReactionPicker({
propsData: {
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p
}
}).$mount().$el);
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p
}
}).$mount().$el);
});
},
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: {
(this as any).os.new(MkMessagingRoomWindow, {
user: user
}
}).$mount().$el);
});
},
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: {
(this as any).os.new(MkFollowingWindow, {
user: this.user
}
}).$mount().$el);
});
},
showFollowers() {
document.body.appendChild(new MkFollowersWindow({
parent: this,
propsData: {
(this as any).os.new(MkFollowersWindow, {
user: this.user
}
}).$mount().$el);
});
},
mute() {

View File

@ -87,18 +87,6 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
// アプリ基底要素マウント
document.body.innerHTML = '<div id="app"></div>';
const launch = (api: (os: MiOS) => API) => {
os.apis = api(os);
Vue.mixin({
data() {
return {
os,
api: os.api,
apis: os.apis
};
}
});
const app = new Vue({
router: new VueRouter({
mode: 'history'
@ -112,7 +100,25 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
});
},
render: createEl => createEl(App)
}).$mount('#app');
});
os.app = app;
const launch = (api: (os: MiOS) => API) => {
os.apis = api(os);
Vue.mixin({
data() {
return {
os,
api: os.api,
apis: os.apis
};
}
});
// マウント
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: {
(this as any).os.new(MkReactionPicker, {
source: this.$refs.reactButton,
post: this.p,
compact: true
}
}).$mount().$el);
});
},
menu() {
document.body.appendChild(new MkPostMenu({
propsData: {
(this as any).os.new(MkPostMenu, {
source: this.$refs.menuButton,
post: this.p,
compact: true
}
}).$mount().$el);
});
}
}
});

View File

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

View File

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