You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

63 lines
1.4 KiB

<template>
<div class="tw-flex tw-flex-col">
<label class="tw-mb-[10px] tw-font-normal" :for="select.id"><span>{{ $t(select.label)
}}<span v-if="select.required" class="required">*</span></span></label>
<select :class="['tw-pr-[40px]',validation ? '' : 'tw-border-error-default']" :name="select.id" v-model="value"
@change="inputVal">
<option :value="0">{{ $t("Select option") }}</option>
<option v-for="{ id, name } in selectList" :key="id" :value="id">
{{ name }}
</option>
</select>
</div>
</template>
<script>
export default {
name: "ElementSelect",
props: {
select: {
type: Object,
},
selectList: {
type: Array,
},
default: {
type: String,
},
validation: {
type: Boolean,
},
},
data() {
return {
value: this.default ?? null,
};
},
mounted() { },
watch: {
default: {
handler: function () {
this.value = this.default;
},
},
},
methods: {
inputVal() {
this.$emit("change", this.value);
},
},
};
</script>
<style lang="scss" scoped>
select {
-moz-appearance: none;
/* Firefox */
-webkit-appearance: none;
/* Safari and Chrome */
appearance: none;
background-image: url("~/assets/svg/down-arrow.svg");
background-size: 9px 6px;
background-position: right 20px center;
background-repeat: no-repeat;
}
</style>