index.jsx 942 B

123456789101112131415161718192021222324252627282930
  1. import { ElButton } from 'element-plus'
  2. import './index.less'
  3. export default {
  4. name: 'CipSearchInput',
  5. props: {
  6. modelValue: {},
  7. loading: Boolean,
  8. buttonText: String
  9. },
  10. emits: ['search', 'update:modelValue'],
  11. setup (props, { emit, slots }) {
  12. const emitValue = (e) => {
  13. emit('update:modelValue', e.target.value)
  14. }
  15. return () => <div class={'cip-search-input__wrapper'}>
  16. <div class={'cip-search-input'}>
  17. <input class={'cip-search-input__input'} value={props.modelValue} onInput={(e) => emitValue(e)}/>
  18. <ElButton
  19. class={'cip-search-input__button'}
  20. type={'primary'}
  21. icon={'el-icon-search'}
  22. onClick={() => emit('search')}
  23. loading={props.loading}
  24. >{props.buttonText || slots.buttonText?.() || '搜索'}</ElButton>
  25. </div>
  26. {slots?.append && <div style={{ marginLeft: '12px' }}>{slots?.append()}</div>}
  27. </div>
  28. }
  29. }