This commit is contained in:
syuilo 2018-02-22 02:15:46 +09:00
parent abf1c30ce6
commit 73029df58a
6 changed files with 53 additions and 17 deletions

View file

@ -1,5 +1,9 @@
import PostForm from '../views/components/post-form.vue';
import RepostForm from '../views/components/repost-form.vue';
export default function(opts) {
const o = opts || {};
export default opts => {
const app = document.getElementById('app');
app.style.display = 'none';
@ -7,8 +11,23 @@ export default opts => {
app.style.display = 'block';
}
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
form
.on('cancel', recover)
.on('post', recover);
};
if (o.repost) {
const vm = new RepostForm({
propsData: {
repost: o.repost
}
}).$mount();
vm.$once('cancel', recover);
vm.$once('post', recover);
document.body.appendChild(vm.$el);
} else {
const vm = new PostForm({
propsData: {
reply: o.reply
}
}).$mount();
vm.$once('cancel', recover);
vm.$once('post', recover);
document.body.appendChild(vm.$el);
}
}