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.
 
 

66 lines
1.4 KiB

<template>
<div class="tw-flex tw-flex-col">
<label class="tw-mb-[10px]" :for="select.id"><span>{{ select.label
}}<span v-if="select.required" class="required">*</span></span></label>
<select :class="['tw-pr-[40px]',validation ? '' : 'tw-bg-white tw-rounded-[10px]']" :name="select.id"
v-model="value" @change="inputVal">
<option value="0">{{ defaultOptionMsg }}</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: Number,
},
validation: {
type: Boolean,
},
defaultOptionMsg: {
type: String,
},
},
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>