custom-prefix-icon.vue 946 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <div class="demo-date-picker">
  3. <div class="block">
  4. <span class="demonstration">set prefix-icon</span>
  5. <el-date-picker v-model="value1" type="date" placeholder="Pick a day" :prefix-icon="customPrefix" />
  6. </div>
  7. </div>
  8. </template>
  9. <script lang="ts" setup>
  10. import { h, ref, shallowRef } from 'vue'
  11. const value1 = ref('')
  12. const customPrefix = shallowRef({
  13. render() {
  14. return h('p', 'pre')
  15. },
  16. })
  17. </script>
  18. <style scoped>
  19. .demo-date-picker {
  20. display: flex;
  21. width: 100%;
  22. padding: 0;
  23. flex-wrap: wrap;
  24. }
  25. .demo-date-picker .block {
  26. padding: 30px 0;
  27. text-align: center;
  28. border-right: solid 1px var(--el-border-color);
  29. flex: 1;
  30. }
  31. .demo-date-picker .block:last-child {
  32. border-right: none;
  33. }
  34. .demo-date-picker .demonstration {
  35. display: block;
  36. color: var(--el-text-color-secondary);
  37. font-size: 14px;
  38. margin-bottom: 20px;
  39. }
  40. </style>