Skip to content

Commit 8dd1620

Browse files
committed
fix: 【textarea】textarea.tsx文件tap缩进调整为空格缩进
1 parent 7d4d224 commit 8dd1620

File tree

1 file changed

+85
-82
lines changed

1 file changed

+85
-82
lines changed

devui/textarea/src/textarea.tsx

Lines changed: 85 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,89 @@
1-
import { defineComponent, ref } from 'vue'
2-
import { textareaProps, TextareaProps } from './textarea-types'
3-
import './textarea.scss'
1+
import { defineComponent, ref } from 'vue';
2+
import { textareaProps, TextareaProps } from './textarea-types';
3+
import './textarea.scss';
44

55
export default defineComponent({
6-
name: 'DTextarea',
7-
props: textareaProps,
8-
emits: ['update:value', 'focus', 'blur', 'change', 'keydown'],
9-
setup(props: TextareaProps, ctx) {
10-
const textareaCls = {
11-
error: props.error,
12-
[props.cssClass]: true,
13-
}
6+
name: 'DTextarea',
7+
props: textareaProps,
8+
emits: ['update:value', 'focus', 'blur', 'change', 'keydown'],
9+
setup(props: TextareaProps, ctx) {
10+
const textareaCls = {
11+
error: props.error,
12+
[props.cssClass]: true,
13+
};
1414

15-
const curValueRef = ref<string>(props.value)
16-
const onInput = ($event: Event) => {
17-
const inputValue = ($event.target as HTMLInputElement).value
18-
curValueRef.value = inputValue
19-
ctx.emit('update:value', inputValue);
20-
},
21-
onFocus = ($event: Event) => {
22-
ctx.emit('focus', $event);
23-
},
24-
onBlur = ($event: Event) => {
25-
ctx.emit('blur', $event);
26-
},
27-
onChange = ($event: Event) => {
28-
ctx.emit('change', ($event.target as HTMLInputElement).value);
29-
},
30-
onKeydown = ($event: KeyboardEvent) => {
31-
ctx.emit('keydown', $event);
32-
};
15+
const curValueRef = ref<string>(props.value);
16+
const onInput = ($event: Event) => {
17+
const inputValue = ($event.target as HTMLInputElement).value;
18+
curValueRef.value = inputValue;
19+
ctx.emit('update:value', inputValue);
20+
},
21+
onFocus = ($event: Event) => {
22+
ctx.emit('focus', $event);
23+
},
24+
onBlur = ($event: Event) => {
25+
ctx.emit('blur', $event);
26+
},
27+
onChange = ($event: Event) => {
28+
ctx.emit('change', ($event.target as HTMLInputElement).value);
29+
},
30+
onKeydown = ($event: KeyboardEvent) => {
31+
ctx.emit('keydown', $event);
32+
};
3333

34-
return {
35-
textareaCls, onInput, onFocus, onBlur, onChange, onKeydown, curValueRef, autofocus: props.autofocus
36-
};
37-
38-
},
39-
render() {
40-
const {
41-
id,
42-
placeholder,
43-
disabled,
44-
maxLength,
45-
resize,
46-
textareaCls,
47-
onInput,
48-
onFocus,
49-
onBlur,
50-
onChange,
51-
onKeydown,
52-
showCount,
53-
autofocus,
54-
curValueRef,
55-
} = this
56-
return (
57-
<div class='devui-textarea-wrap'
58-
>
59-
<textarea
60-
{...{ DTextarea: true }}
61-
id={id}
62-
value={curValueRef}
63-
autofocus={autofocus}
64-
placeholder={placeholder}
65-
disabled={disabled}
66-
maxlength={maxLength}
67-
style={{ resize: resize }}
68-
class={textareaCls}
69-
onInput={onInput}
70-
onFocus={onFocus}
71-
onBlur={onBlur}
72-
onChange={onChange}
73-
onKeydown={onKeydown}
74-
>
75-
</textarea>
76-
{
77-
showCount && <div
78-
class='devui-textarea-show-count'>
79-
{curValueRef.length}
80-
{!(maxLength ?? false) ? '' : ' / ' + maxLength}
81-
</div>
82-
}
83-
</div>
84-
)
85-
}
86-
})
34+
return {
35+
textareaCls,
36+
onInput,
37+
onFocus,
38+
onBlur,
39+
onChange,
40+
onKeydown,
41+
curValueRef,
42+
autofocus: props.autofocus,
43+
};
44+
},
45+
render() {
46+
const {
47+
id,
48+
placeholder,
49+
disabled,
50+
maxLength,
51+
resize,
52+
textareaCls,
53+
onInput,
54+
onFocus,
55+
onBlur,
56+
onChange,
57+
onKeydown,
58+
showCount,
59+
autofocus,
60+
curValueRef,
61+
} = this;
62+
return (
63+
<div class="devui-textarea-wrap">
64+
<textarea
65+
{...{ DTextarea: true }}
66+
id={id}
67+
value={curValueRef}
68+
autofocus={autofocus}
69+
placeholder={placeholder}
70+
disabled={disabled}
71+
maxlength={maxLength}
72+
style={{ resize: resize }}
73+
class={textareaCls}
74+
onInput={onInput}
75+
onFocus={onFocus}
76+
onBlur={onBlur}
77+
onChange={onChange}
78+
onKeydown={onKeydown}
79+
></textarea>
80+
{showCount && (
81+
<div class="devui-textarea-show-count">
82+
{curValueRef.length}
83+
{!(maxLength ?? false) ? '' : ' / ' + maxLength}
84+
</div>
85+
)}
86+
</div>
87+
);
88+
},
89+
});

0 commit comments

Comments
 (0)