| | |
| | | <template> |
| | | <div class="flex flex-col gap-1"> |
| | | <div class="flex flex-col gap-2"> |
| | | <span class="text-gray-600 font-normal">{{ `${order} ${item?.data?.title}` }}</span> |
| | | <div class="flex-items-center gap-5"> |
| | | <!-- <span |
| | |
| | | :class="{ 'cursor-not-allowed': disabled, 'bg-blue-400': subItem === activeOption, 'text-white': subItem === activeOption }" |
| | | >{{ subItem }}</span |
| | | > --> |
| | | <el-select v-if="isSelect" v-model="activeOption" placeholder="请选择" @change="debounceSelect"> |
| | | <el-select v-if="isSelect" v-model="activeOption" placeholder="请选择" @change="selectChange"> |
| | | <el-option v-for="item in item?.data?.options" :key="item" :label="item" :value="item"></el-option> |
| | | </el-select> |
| | | <el-input v-else @input="debounceSelect" v-model="activeOption" /> |
| | | <div v-else class="flex items-center gap-3"> |
| | | <el-input v-model="inputValue" /> |
| | | <el-button type="primary" @click="submitInput">提交</el-button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | |
| | | // :class="[...(subItem === activeOption ? ['bg-blue-400', 'text-white'] : []), disabled ? 'cursor-not-allowed' : '']" |
| | | // 'bg-blue-400': subItem === activeOption, 'text-white': subItem === activeOption.value |
| | | const isSelect = computed(() => props.item?.data?.options?.length > 0); |
| | | |
| | | const inputValue = ref(''); |
| | | const activeOption = ref(); |
| | | const selectChange = async (option) => { |
| | | if (props.disabled) return; |
| | |
| | | activeOption.value = option; |
| | | } |
| | | }; |
| | | const debounceSelect = debounce(selectChange, 500); |
| | | |
| | | const submitInput = () => { |
| | | selectChange(inputValue.value); |
| | | }; |
| | | </script> |
| | | <style scoped lang="scss"></style> |