Connect comment data to ui
This commit is contained in:
@@ -1,24 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
// type
|
||||
|
||||
type Props = {
|
||||
title: string,
|
||||
date: string,
|
||||
username: string,
|
||||
content: string,
|
||||
rate : number
|
||||
}
|
||||
title: string;
|
||||
date: string;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
content: string;
|
||||
rate: number;
|
||||
};
|
||||
|
||||
// props
|
||||
|
||||
const props = defineProps<Props>();
|
||||
const { date } = toRefs(props);
|
||||
const { date, first_name, last_name } = toRefs(props);
|
||||
|
||||
// state
|
||||
|
||||
const formattedDate = useDateFormat(date.value, "YYYY/MM/DD");
|
||||
|
||||
// computed
|
||||
|
||||
const username = computed(() => {
|
||||
if (first_name.value.length === 0 || last_name.value.length === 0) {
|
||||
return "کاربر هیملز";
|
||||
}
|
||||
|
||||
return `${first_name.value} ${last_name.value}`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user