fix: propType validation in message.vue
This commit is contained in:
parent
27cd9535bf
commit
9a3069c20d
@ -7,7 +7,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed} from 'vue'
|
import {computed, PropType} from 'vue'
|
||||||
|
|
||||||
|
const TEXT_ALIGN_MAP = Object.freeze({
|
||||||
|
left: '',
|
||||||
|
center: 'has-text-centered',
|
||||||
|
right: 'has-text-right',
|
||||||
|
})
|
||||||
|
|
||||||
|
type textAlignVariants = keyof typeof TEXT_ALIGN_MAP
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
variant: {
|
variant: {
|
||||||
@ -15,21 +23,12 @@ const props = defineProps({
|
|||||||
default: 'info',
|
default: 'info',
|
||||||
},
|
},
|
||||||
textAlign: {
|
textAlign: {
|
||||||
type: String,
|
type: String as PropType<textAlignVariants>,
|
||||||
default: 'left',
|
default: 'left',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const textAlignClass = computed(() => {
|
const textAlignClass = computed(() => TEXT_ALIGN_MAP[props.textAlign])
|
||||||
switch (props.textAlign) {
|
|
||||||
case 'left':
|
|
||||||
return ''
|
|
||||||
case 'right':
|
|
||||||
return 'has-text-right'
|
|
||||||
case 'center':
|
|
||||||
return 'has-text-centered'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user