Fix withDefaults

This commit is contained in:
Kasper Seweryn 2022-05-01 17:26:43 +02:00 committed by Georg Krause
parent 2f8f7cbafa
commit 39b4e9a5b9
3 changed files with 10 additions and 5 deletions

View File

@ -58,6 +58,7 @@
"@types/qs": "6.9.7", "@types/qs": "6.9.7",
"@typescript-eslint/eslint-plugin": "5.19.0", "@typescript-eslint/eslint-plugin": "5.19.0",
"@vitejs/plugin-vue": "2.3.1", "@vitejs/plugin-vue": "2.3.1",
"@vue/compiler-sfc": "3.2.33",
"@vue/eslint-config-standard": "6.1.0", "@vue/eslint-config-standard": "6.1.0",
"@vue/eslint-config-typescript": "10.0.0", "@vue/eslint-config-typescript": "10.0.0",
"@vue/test-utils": "1.3.0", "@vue/test-utils": "1.3.0",
@ -77,8 +78,8 @@
"jest-cli": "27.5.1", "jest-cli": "27.5.1",
"moxios": "0.4.0", "moxios": "0.4.0",
"sinon": "13.0.2", "sinon": "13.0.2",
"typescript": "^4.6.3",
"ts-jest": "27.1.4", "ts-jest": "27.1.4",
"typescript": "^4.6.3",
"vite": "2.8.6", "vite": "2.8.6",
"vite-plugin-pwa": "0.12.0", "vite-plugin-pwa": "0.12.0",
"vue-jest": "3.0.7", "vue-jest": "3.0.7",

View File

@ -7,9 +7,11 @@ interface Props {
size?: string size?: string
} }
const { isLoading, size } = toRefs(withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
size: 'small' size: 'small'
})) })
const { isLoading, size } = toRefs(props)
const isDone = refAutoReset(false, 2000) const isDone = refAutoReset(false, 2000)
watch(isLoading, loading => { watch(isLoading, loading => {

View File

@ -12,12 +12,14 @@ interface Props {
truncateLength?: number truncateLength?: number
} }
const { displayName, actor, truncateLength, admin, avatar } = toRefs(withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
avatar: true, avatar: true,
admin: false, admin: false,
displayName: false, displayName: false,
truncateLength: 30 truncateLength: 30
})) })
const { displayName, actor, truncateLength, admin, avatar } = toRefs(props)
const repr = computed(() => { const repr = computed(() => {
const name = displayName.value || actor.value.is_local const name = displayName.value || actor.value.is_local