-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
114 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script setup lang="ts"> | ||
const props = withDefaults(defineProps<{ | ||
count?: number | ||
isDot?: boolean | ||
}>(), { | ||
}) | ||
const showCount = computed(() => { | ||
if (props.count && !props.isDot) | ||
return true | ||
return false | ||
}) | ||
const badgeClass = computed(() => { | ||
if (showCount.value) | ||
return 'rounded-10px color-white px-5px top--5px right--4px h-18px' | ||
return 'w-8px h-8px rounded top--2px right--4px' | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div relative> | ||
<slot /> | ||
<div | ||
v-if="count" | ||
absolute text-12px | ||
bg="red" | ||
:class="badgeClass" | ||
> | ||
{{ showCount ? count : '' }} | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import type { App, Plugin } from 'vue' | ||
import NcBadge from './badge.vue' | ||
|
||
export const NcBadgePlugin: Plugin = { | ||
install(app: App) { | ||
app.component(NcBadge.name, NcBadge) | ||
}, | ||
} | ||
|
||
export { NcBadge } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,6 @@ export interface Contact { | |
lastTime?: number | ||
avatar: string | ||
quiet?: boolean | ||
unread?: number | ||
index: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters