index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { defineComponent, ref } from 'vue';
  2. import styles from './index.module.less';
  3. import { NImage, NInput, NIcon, dividerDark } from 'naive-ui';
  4. import { renderfontsvg } from '@/utils/index';
  5. import disSearch from './images/disSearch.png';
  6. import searchIcon from './images/searchIcon.png';
  7. export default defineComponent({
  8. name: 'student-studentList',
  9. props: ['searchWord'],
  10. emits: ['changeValue'],
  11. setup(props, { emit, attrs }) {
  12. const isFocus = ref(false);
  13. return () => (
  14. <>
  15. <NInput
  16. {...attrs}
  17. clearable
  18. class={styles.searchInput}
  19. v-slots={{
  20. prefix: () => (
  21. <NImage
  22. class={styles.searchIcon}
  23. previewDisabled
  24. src={isFocus.value ? searchIcon : disSearch}></NImage>
  25. )
  26. }}
  27. value={props.searchWord}
  28. onInput={($event: any) => {
  29. emit('changeValue', $event);
  30. }}
  31. onFocus={() => {
  32. isFocus.value = true;
  33. }}
  34. onBlur={() => {
  35. isFocus.value = false;
  36. }}></NInput>
  37. </>
  38. );
  39. }
  40. });