Skip to content

Commit

Permalink
feat: defineProps 格式统一
Browse files Browse the repository at this point in the history
  • Loading branch information
Plumbiu committed Feb 13, 2023
1 parent 6f61f4f commit a5e2a47
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
24 changes: 9 additions & 15 deletions frontend/components/ArticlesList/Item/Bar/Top.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
<script setup lang="ts">
import type { ITagItem } from '~~/types/IArticleItem'
defineProps({
duration: String,
tags: {
type: Array<ITagItem>,
default: [],
},
authorId: {
type: Object,
default: () => {},
},
adId: String,
})
import type { IAuthor, ITagItem } from '~~/types/IArticleItem'
defineProps<{
duration: string
tags?: ITagItem[]
authorId?: IAuthor
adId?: string
}>()
</script>

<template>
<div class="topbar">
<div class="author">
<span class="name">{{ adId ? adId : authorId.name }}</span>
<span class="name">{{ adId ? adId : authorId?.name }}</span>
<ArticlesListItemAuthorCard
v-if="authorId"
:name="authorId.name"
Expand All @@ -27,7 +21,7 @@ defineProps({
class="info"
/>
</div>
<span :class="`duration ${tags.length ? 'b-r-1' : ''}`">{{ duration }}</span>
<span :class="`duration ${tags?.length ? 'b-r-1' : ''}`">{{ duration }}</span>
<div class="flex px-3">
<div v-for="(item, index) of tags" :key="item.tag" class="tag">
<div v-if="index" class="icon" />
Expand Down
1 change: 1 addition & 0 deletions frontend/types/IArticleItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ export {
IArticleItem,
ITagItem,
IArticleAd,
IAuthor,
ICatalogue,
}

0 comments on commit a5e2a47

Please sign in to comment.