mixed-input.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <div>
  3. <el-input v-model="input1" placeholder="Please input">
  4. <template #prepend>Http://</template>
  5. </el-input>
  6. </div>
  7. <div class="mt-4">
  8. <el-input v-model="input2" placeholder="Please input">
  9. <template #append>.com</template>
  10. </el-input>
  11. </div>
  12. <div class="mt-4">
  13. <el-input
  14. v-model="input3"
  15. placeholder="Please input"
  16. class="input-with-select"
  17. >
  18. <template #prepend>
  19. <el-select v-model="select" placeholder="Select" style="width: 115px">
  20. <el-option label="Restaurant" value="1" />
  21. <el-option label="Order No." value="2" />
  22. <el-option label="Tel" value="3" />
  23. </el-select>
  24. </template>
  25. <template #append>
  26. <el-button :icon="Search" />
  27. </template>
  28. </el-input>
  29. </div>
  30. <div class="mt-4">
  31. <el-input
  32. v-model="input3"
  33. placeholder="Please input"
  34. class="input-with-select"
  35. >
  36. <template #prepend>
  37. <el-button :icon="Search" />
  38. </template>
  39. <template #append>
  40. <el-select v-model="select" placeholder="Select" style="width: 115px">
  41. <el-option label="Restaurant" value="1" />
  42. <el-option label="Order No." value="2" />
  43. <el-option label="Tel" value="3" />
  44. </el-select>
  45. </template>
  46. </el-input>
  47. </div>
  48. </template>
  49. <script setup lang="ts">
  50. import { ref } from 'vue'
  51. import { Search } from '@element-plus/icons-vue'
  52. const input1 = ref('')
  53. const input2 = ref('')
  54. const input3 = ref('')
  55. const select = ref('')
  56. </script>
  57. <style>
  58. .input-with-select .el-input-group__prepend {
  59. background-color: var(--el-fill-color-blank);
  60. }
  61. </style>