index.vue 696 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <Search class="app-search" :class="[`bg-${background}`]" :placeholder="t('digital.search')">
  3. <template #left-icon>
  4. <img :src="'./img/icons/search.svg'" :title="t('digital.search')" />
  5. </template>
  6. <template #right-icon>
  7. <slot></slot>
  8. </template>
  9. </Search>
  10. </template>
  11. <script lang="ts" setup>
  12. import { PropType } from 'vue'
  13. import { Search } from 'vant'
  14. import { i18n } from '@/stores'
  15. defineProps({
  16. // 背景颜色
  17. background: {
  18. type: String as PropType<'default' | 'primary'>,
  19. default: 'default'
  20. },
  21. })
  22. const t = i18n.global.t
  23. </script>
  24. <style lang="less">
  25. @import './index.less';
  26. </style>