1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| import { defineComponent, SetupContext, ref, computed } from 'vue'
| import styles from './BaseInput.module.scss'
|
| export default defineComponent({
| name: 'BaseInput',
| emits: ['update:modelValue', 'click'],
| props: {
| modelValue: {
| type: [String, Number],
| default: '',
| },
| placeholder: {
| type: String,
| default: '请输入',
| },
| },
| setup(props, { attrs, slots, emit }: SetupContext) {
| const input = computed({
| get() {
| return props.modelValue
| },
| set(val) {
| emit('update:modelValue', val)
| },
| })
| const onClick = (evt: Event) => {
| evt?.stopPropagation()
| emit('click', evt)
| }
| return () => {
| return (
| <div class={styles.baseInput} onClick={onClick}>
| <input
| placeholder={props.placeholder}
| class={{
| [styles.input]: true,
| [styles.hover]: true,
| }}
| v-model={input.value}
| />
| {/* <span class={styles.hasHover}>
| {input.value ? (
| input.value
| ) : (
| <span style="color:#929AB1;padding-right:200px">
| {props.placeholder}
| </span>
| )}
| </span> */}
| </div>
| )
| }
| },
| })
|
|