with-icon.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <template>
  2. <div class="demo-input-suffix">
  3. <el-row :gutter="20">
  4. <span class="ml-3 w-35 text-gray-600 inline-flex items-center"
  5. >Using attributes</span
  6. >
  7. <el-input
  8. v-model="input1"
  9. class="w-50 m-2"
  10. placeholder="Pick a date"
  11. :suffix-icon="Calendar"
  12. />
  13. <el-input
  14. v-model="input2"
  15. class="w-50 m-2"
  16. placeholder="Type something"
  17. :prefix-icon="Search"
  18. />
  19. </el-row>
  20. </div>
  21. <div class="demo-input-suffix">
  22. <el-row :gutter="20">
  23. <span class="ml-3 w-35 text-gray-600 inline-flex items-center"
  24. >Using slots</span
  25. >
  26. <el-input v-model="input3" class="w-50 m-2" placeholder="Pick a date">
  27. <template #suffix>
  28. <el-icon class="el-input__icon"><calendar /></el-icon>
  29. </template>
  30. </el-input>
  31. <el-input v-model="input4" class="w-50 m-2" placeholder="Type something">
  32. <template #prefix>
  33. <el-icon class="el-input__icon"><search /></el-icon>
  34. </template>
  35. </el-input>
  36. </el-row>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { ref } from 'vue'
  41. import { Calendar, Search } from '@element-plus/icons-vue'
  42. const input1 = ref('')
  43. const input2 = ref('')
  44. const input3 = ref('')
  45. const input4 = ref('')
  46. </script>