base_ui/components/forms/LabelComponentForTerm.vue

77 lines
1.8 KiB
Vue
Raw Permalink Normal View History

2025-02-01 09:34:55 +00:00
<template>
<div class="row form-group mt-3" :key="$attrs.key">
<label :for="localFormElement.key" :class="$attrs.labelClass ?? 'col-md-3'"
>{{ localFormElement.label }}:&nbsp;</label
>
<div
class="mt-2"
:class="[$attrs.inputClass ?? ' col-md-9', { error: hasError }]"
>
<p
class="text__13 label-title form-control-plaintext"
style="
display: -webkit-box !important;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
"
v-html="myText"
></p>
</div>
</div>
</template>
<script>
import formBuilderMixin from "@mixins/formBuilderMixin";
export default {
mixins: [formBuilderMixin],
computed: {
myText() {
// if (this.localFormElement?.type == "date") return this.textDate;
// else
// if (typeof this.textValue === 'string') {
// return this.textValue?.replaceAll('\n', '<br>')
// }
if (typeof this.textValue === "string") {
return this.textValue?.replaceAll("\n", "<br>");
} else if (typeof this.textValue === "number") {
var m = this.textValue*1000;
var d = new Date(m).toLocaleDateString("fa-IR");
return d;
} else {
return "";
}
// return this.textValue;
},
},
mounted() {
// this.textValue = this.localFormElement.value
},
methods: {
// creatValue(item) {
// let value = "";
// let key = item.key;
// if (key == "date_create") {
// var m = item.value * 1000;
// var d = new Date(m).toLocaleDateString("fa-IR");
// value = d;
// }else{
// value = item.value
// }
// return value;
// },
},
};
</script>
<style scoped>
.form-control {
height: auto !important;
}
.label-title {
font-size: 0.9rem !important;
}
</style>