car_trader/components/Car/Ad/Select.vue

21 lines
649 B
Vue

<script setup>
const props = defineProps({
title:String,
name:String,
options: Array
});
const emits = defineEmits(['changeInput']);
const state = ref("");
const onChange = () => {
emits("changeInput",state.value, props.name)
};
</script>
<template>
<div class="flex flex-col w-[48%] ,t-2">
<label class="text-cyan-500 mb-q text-sm">{{ title }}</label>
<select class="p-2 border w-100 rounded" @change="onChange" v-model="state">
<option v-for="option in options" :key="option.id" :value="option">{{ option }}</option>
</select>
</div>
</template>