diff --git a/src/client/components/avatar.vue b/src/client/components/avatar.vue index 004231c163..79590e39f3 100644 --- a/src/client/components/avatar.vue +++ b/src/client/components/avatar.vue @@ -13,6 +13,7 @@ import { getStaticImageUrl } from '../scripts/get-static-image-url'; import { acct, userPage } from '../filters/user'; export default defineComponent({ + emits: ['click'], props: { user: { type: Object, diff --git a/src/client/components/dialog.vue b/src/client/components/dialog.vue index 5f7ca01a8c..c40f3bd0e7 100644 --- a/src/client/components/dialog.vue +++ b/src/client/components/dialog.vue @@ -148,7 +148,7 @@ export default defineComponent({ if (this.autoClose) { setTimeout(() => { - this.$emit('ok'); + this.$emit('done'); }, 1000); } @@ -167,19 +167,19 @@ export default defineComponent({ if (this.user) { const user = await this.$root.api('users/show', parseAcct(this.userInputValue)); if (user) { - this.$emit('ok', user); + this.$emit('done', { canceled: false, result: user }); } } else { const result = this.input ? this.inputValue : this.select ? this.selectedValue : true; - this.$emit('ok', result); + this.$emit('done', { canceled: false, result }); } }, cancel() { - this.$emit('cancel'); + this.$emit('done', { canceled: true }); }, onBgClick() { diff --git a/src/client/pages/test.vue b/src/client/pages/test.vue index 98d9492615..46d9dbbc68 100644 --- a/src/client/pages/test.vue +++ b/src/client/pages/test.vue @@ -10,6 +10,9 @@ Show +
+ Result: {{ dialogResult }} +
@@ -35,15 +38,16 @@ export default defineComponent({ data() { return { dialogTitle: 'Title', + dialogResult: null, faExclamationTriangle } }, methods: { - showDialog() { - this.$root.showDialog({ + async showDialog() { + this.dialogResult = await this.$store.dispatch('showDialog', { title: this.dialogTitle, - }) + }); } } }); diff --git a/src/client/root.vue b/src/client/root.vue index 694f99a73c..6c4bf23c05 100644 --- a/src/client/root.vue +++ b/src/client/root.vue @@ -2,7 +2,8 @@ - +