You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
562 B
26 lines
562 B
import { computed } from "vue"
|
|
import { useI18n } from "vue-i18n"
|
|
|
|
export function useAvatarList(props) {
|
|
const { t } = useI18n()
|
|
|
|
const several = computed(() => props.users.length > props.countSeveral && props.shortSeveral)
|
|
|
|
const userList = computed(() => (several.value ? props.users.slice(0, props.countSeveral) : props.users))
|
|
|
|
const plusText = computed(() => {
|
|
let diff = props.users.length - props.countSeveral
|
|
|
|
if (diff) {
|
|
return t("+%d", [diff])
|
|
}
|
|
|
|
return ""
|
|
})
|
|
|
|
return {
|
|
several,
|
|
userList,
|
|
plusText,
|
|
}
|
|
}
|
|
|