summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-22 05:57:24 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-22 05:57:24 +0900
commit0b1bcf614ba2467fdc638354418f1077a20919ad (patch)
tree4cf41db0d7beeede6757b2e1933a404b0682a3de /src/web/app/common
parentwip (diff)
downloadmisskey-0b1bcf614ba2467fdc638354418f1077a20919ad.tar.gz
misskey-0b1bcf614ba2467fdc638354418f1077a20919ad.tar.bz2
misskey-0b1bcf614ba2467fdc638354418f1077a20919ad.zip
wip
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/views/components/poll-editor.vue12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/web/app/common/views/components/poll-editor.vue b/src/web/app/common/views/components/poll-editor.vue
index 7428d80547..065e919660 100644
--- a/src/web/app/common/views/components/poll-editor.vue
+++ b/src/web/app/common/views/components/poll-editor.vue
@@ -4,7 +4,7 @@
%fa:exclamation-triangle%%i18n:common.tags.mk-poll-editor.no-only-one-choice%
</p>
<ul ref="choices">
- <li v-for="(choice, i) in choices" :key="choice">
+ <li v-for="(choice, i) in choices">
<input :value="choice" @input="onInput(i, $event)" :placeholder="'%i18n:common.tags.mk-poll-editor.choice-n%'.replace('{}', i + 1)">
<button @click="remove(i)" title="%i18n:common.tags.mk-poll-editor.remove%">
%fa:times%
@@ -26,6 +26,11 @@ export default Vue.extend({
choices: ['', '']
};
},
+ watch: {
+ choices() {
+ this.$emit('updated');
+ }
+ },
methods: {
onInput(i, e) {
Vue.set(this.choices, i, e.target.value);
@@ -33,7 +38,9 @@ export default Vue.extend({
add() {
this.choices.push('');
- (this.$refs.choices as any).childNodes[this.choices.length - 1].childNodes[0].focus();
+ this.$nextTick(() => {
+ (this.$refs.choices as any).childNodes[this.choices.length - 1].childNodes[0].focus();
+ });
},
remove(i) {
@@ -53,6 +60,7 @@ export default Vue.extend({
set(data) {
if (data.choices.length == 0) return;
this.choices = data.choices;
+ if (data.choices.length == 1) this.choices = this.choices.concat('');
}
}
});