Statiskt presentationsfält används för att presentera information som användaren inte ska kunna redigera och är statisk.
Förslagsvis så kombineras komponenten med Format Plugin för att formatera resultaten på önskat sätt.
Visa kod
<script >
import { defineComponent } from "vue" ;
import { FStaticField , FTextField } from "@fkui/vue" ;
export default defineComponent ({
name : "FStaticFieldTextField" ,
components : { FStaticField , FTextField },
data ( ) {
return { name : "" };
},
});
</script >
<template >
<div data-test ="output-field" >
<f-text-field
id ="normal"
v-model ="name"
v-validation.maxLength ="{ maxLength: { length: 100 } }"
>
Namn
</f-text-field >
<f-static-field >
<template #label > Beskrivning </template >
En liten statisk beskrivning.
</f-static-field >
</div >
</template >
Visa kod
<script >
import { defineComponent } from "vue" ;
import { FStaticField , FTooltip } from "@fkui/vue" ;
export default defineComponent ({
name : "FStaticFieldTooltipDescription" ,
components : { FStaticField , FTooltip },
});
</script >
<template >
<div data-test ="output-field" >
<f-static-field >
<template #label > Etikett </template >
<template #tooltip >
<f-tooltip screen-reader-text ="Läs mer om avancerat fält" header-tag ="h2" >
<template #header > Mer om avancerat fält </template >
<template #body > Detta fältet kräver lite närmare förklaring. </template >
</f-tooltip >
</template >
<template #description ="{ descriptionClass, formatDescriptionClass }" >
<span :class ="descriptionClass" > Beskrivning av etikett </span >
<span :class ="formatDescriptionClass" > (format) </span >
</template >
<template #default > En liten statisk text. </template >
</f-static-field >
</div >
</template >
Visa kod
<script setup lang ="ts" >
import { FStaticField } from "@fkui/vue" ;
const date = "20200101" ;
</script >
<template >
<f-static-field >
<template #label > Formaterat datum </template >
<span v-format:date-full ="date" > </span >
</f-static-field >
</template >
label
Slot for label content.
tooltip
Slot primarily for tooltip.
description
Optional slot for description. See FLabel
for details.
Bindings:
description-class: string[]
— CSS classes for primary description content.format-description-class: string[]
— CSS classes for format description.
default
Slot for text content.