Files
baserow/web-frontend/modules/builder/components/FontFamilySelector.vue
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

54 lines
1.2 KiB
Vue

<template>
<Dropdown :value="currentValue" fixed-items @input="input">
<DropdownItem
v-for="fontFamily in fontFamilies"
:key="fontFamily.getType()"
:value="fontFamily.getType()"
:name="fontFamily.name"
/>
</Dropdown>
</template>
<script>
export default {
name: 'FontFamilySelector',
props: {
/**
* The model value of the dropdown in Vue 3 style.
*/
modelValue: {
type: String,
default: undefined,
},
/**
* The model value of the dropdown in Vue 2 style.
*/
value: {
type: String,
required: false,
default: 'Inter',
},
},
emits: ['input', 'update:modelValue'],
computed: {
// This computed must be used instead of .value
currentValue() {
return this.modelValue !== undefined ? this.modelValue : this.value
},
fontFamilies() {
return Object.values(this.$registry.getAll('fontFamily')).sort((a, b) =>
a.name.localeCompare(b.name)
)
},
},
methods: {
input(value) {
// emitting the updated value Vue 3 style.
this.$emit('update:modelValue', value)
// emitting the updated value Vue 2 style.
this.$emit('input', value)
},
},
}
</script>