refactor(client): use setup syntax

This commit is contained in:
syuilo 2022-06-28 14:34:44 +09:00
parent 97b4d43871
commit baa5ddfb75

View file

@ -72,8 +72,8 @@
</div>
</template>
<script lang="ts">
import { defineComponent, ref, onMounted, onUnmounted, watch } from 'vue';
<script lang="ts" setup>
import { ref, onMounted, onUnmounted, watch } from 'vue';
import * as misskey from 'misskey-js';
import XReactionIcon from './reaction-icon.vue';
import MkFollowButton from './follow-button.vue';
@ -86,29 +86,15 @@ import * as os from '@/os';
import { stream } from '@/stream';
import { useTooltip } from '@/scripts/use-tooltip';
export default defineComponent({
components: {
XReactionIcon, MkFollowButton,
},
const props = withDefaults(defineProps<{
notification: misskey.entities.Notification;
withTime?: boolean;
full?: boolean;
}>(), {
withTime: false,
full: false,
});
props: {
notification: {
type: Object,
required: true,
},
withTime: {
type: Boolean,
required: false,
default: false,
},
full: {
type: Boolean,
required: false,
default: false,
},
},
setup(props) {
const elRef = ref<HTMLElement>(null);
const reactionRef = ref(null);
@ -172,23 +158,6 @@ export default defineComponent({
targetElement: reactionRef.value.$el,
}, {}, 'closed');
});
return {
getNoteSummary: (note: misskey.entities.Note) => getNoteSummary(note),
followRequestDone,
groupInviteDone,
notePage,
userPage,
acceptFollowRequest,
rejectFollowRequest,
acceptGroupInvitation,
rejectGroupInvitation,
elRef,
reactionRef,
i18n,
};
},
});
</script>
<style lang="scss" scoped>