with-icon.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. <kk-input
  8. v-model="input1"
  9. class="w-50 m-2"
  10. placeholder="Pick a date"
  11. :suffix-icon="Calendar"
  12. />
  13. <kk-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. <kk-input v-model="input3" class="w-50 m-2" placeholder="Pick a date">
  27. <template #suffix>
  28. <kk-icon class="el-input__icon"><calendar /></kk-icon>
  29. </template>
  30. </kk-input>
  31. <kk-input v-model="input4" class="w-50 m-2" placeholder="Type something">
  32. <template #prefix>
  33. <kk-icon class="el-input__icon"><search /></kk-icon>
  34. </template>
  35. </kk-input>
  36. </el-row>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { ref } from 'vue'
  41. import { KkIcon, KkInput } from 'kankan-components'
  42. import { Calendar, Search } from '@kankan-components/icons-vue'
  43. const input1 = ref('')
  44. const input2 = ref('')
  45. const input3 = ref('')
  46. const input4 = ref('')
  47. </script>