From bbc8ed5307fcc6e4cff30d8dacc1b07a420b74ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Fri, 25 Nov 2022 15:12:49 +0800 Subject: [PATCH] refactor: switch to setup-sfc --- components/account/AccountHeader.vue | 2 +- components/account/AccountInfo.vue | 2 +- components/account/AccountInlineInfo.vue | 2 +- components/account/AccountLink.vue | 2 +- components/content/ContentRich.setup.ts | 19 +++++++++++ components/content/ContentRich.ts | 24 ------------- components/status/StatusAccountDetails.vue | 2 +- components/status/StatusBody.vue | 2 +- package.json | 2 +- pnpm-lock.yaml | 39 ++++++++++++++++------ 10 files changed, 55 insertions(+), 41 deletions(-) create mode 100644 components/content/ContentRich.setup.ts delete mode 100644 components/content/ContentRich.ts diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 0f6cec13..be1ede2d 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -59,7 +59,7 @@ function getFieldNameIcon(fieldName: string) {
- +

{{ getAccountHandle(account) }}

diff --git a/components/account/AccountInfo.vue b/components/account/AccountInfo.vue index 986cff86..63f5f95c 100644 --- a/components/account/AccountInfo.vue +++ b/components/account/AccountInfo.vue @@ -18,7 +18,7 @@ const accountHandle = $(useAccountHandle(account, fullServer))
- +

{{ accountHandle }}

diff --git a/components/account/AccountInlineInfo.vue b/components/account/AccountInlineInfo.vue index 88ba79da..1163c613 100644 --- a/components/account/AccountInlineInfo.vue +++ b/components/account/AccountInlineInfo.vue @@ -10,6 +10,6 @@ const { link = true } = defineProps<{ diff --git a/components/account/AccountLink.vue b/components/account/AccountLink.vue index d425b2f5..05be6506 100644 --- a/components/account/AccountLink.vue +++ b/components/account/AccountLink.vue @@ -8,6 +8,6 @@ defineProps<{ diff --git a/components/content/ContentRich.setup.ts b/components/content/ContentRich.setup.ts new file mode 100644 index 00000000..59c90422 --- /dev/null +++ b/components/content/ContentRich.setup.ts @@ -0,0 +1,19 @@ +import type { Emoji } from 'masto' +import { emojisArrayToObject } from '~/composables/utils' + +defineOptions({ + name: 'ContentRich', +}) + +const props = defineProps<{ + content: string + emojis: Emoji[] +}>() + +const emojiObject = emojisArrayToObject(props.emojis || []) + +export default () => h( + 'div', + { class: 'rich-content' }, + contentToVNode(props.content, emojiObject), +) diff --git a/components/content/ContentRich.ts b/components/content/ContentRich.ts deleted file mode 100644 index a72bdd06..00000000 --- a/components/content/ContentRich.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { Emoji } from 'masto' -import type { PropType } from 'vue' -import { emojisArrayToObject } from '~/composables/utils' - -export default defineComponent({ - props: { - content: { - type: String, - required: true, - }, - emojis: { - type: Array as PropType, - }, - }, - setup(props) { - const emojiObject = emojisArrayToObject(props.emojis || []) - - return () => h( - 'div', - { class: 'rich-content' }, - contentToVNode(props.content, emojiObject), - ) - }, -}) diff --git a/components/status/StatusAccountDetails.vue b/components/status/StatusAccountDetails.vue index 4b8c7898..44af5735 100644 --- a/components/status/StatusAccountDetails.vue +++ b/components/status/StatusAccountDetails.vue @@ -11,7 +11,7 @@ const accountHandle = $(useAccountHandle(account))