Skip to content

Commit ecf3e29

Browse files
committed
fix(input): [input] fix textarea disabled style error
1 parent f0a1244 commit ecf3e29

File tree

5 files changed

+90
-4
lines changed

5 files changed

+90
-4
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div class="demo-input">
3+
<tiny-input v-model="input" disabled placeholder="input"></tiny-input>
4+
<tiny-input type="textarea" disabled v-model="input" placeholder="textarea"></tiny-input>
5+
</div>
6+
</template>
7+
8+
<script setup>
9+
import { ref } from 'vue'
10+
import { Input as TinyInput } from '@opentiny/vue'
11+
12+
const input = ref('')
13+
</script>
14+
15+
<style scoped>
16+
.demo-input {
17+
width: 300px;
18+
}
19+
20+
.demo-input > div {
21+
margin-top: 10px;
22+
}
23+
</style>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { test, expect } from '@playwright/test'
2+
3+
test('disabled', async ({ page }) => {
4+
page.on('pageerror', (exception) => expect(exception).toBeNull())
5+
await page.goto('input#disabled')
6+
const demo = page.locator('#disabled')
7+
const input = demo.getByRole('textbox', { name: 'input' })
8+
const textarea = page.getByRole('textbox', { name: 'textarea' })
9+
await expect(input).toHaveAttribute('disabled', '')
10+
await expect(textarea).toHaveAttribute('disabled', '')
11+
})
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<div class="demo-input">
3+
<tiny-input v-model="input" disabled placeholder="input"></tiny-input>
4+
<tiny-input type="textarea" disabled v-model="input" placeholder="textarea"></tiny-input>
5+
</div>
6+
</template>
7+
8+
<script>
9+
import { Input } from '@opentiny/vue'
10+
11+
export default {
12+
components: {
13+
TinyInput: Input
14+
},
15+
data() {
16+
return {
17+
input: ''
18+
}
19+
}
20+
}
21+
</script>
22+
23+
<style scoped>
24+
.demo-input {
25+
width: 300px;
26+
}
27+
28+
.demo-input > div {
29+
margin-top: 10px;
30+
}
31+
</style>

examples/sites/demos/pc/app/input/webdoc/input.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ export default {
2727
},
2828
codeFiles: ['clearable.vue']
2929
},
30+
{
31+
demoId: 'disabled',
32+
name: {
33+
'zh-CN': '禁用',
34+
'en-US': 'Disabled'
35+
},
36+
desc: {
37+
'zh-CN': '<p>可通过 <code>disabled</code> 属性设置输入框的禁用状态。</p>',
38+
'en-US':
39+
'<p>You can set the <code>clearable</code> attribute to display the clear icon button in the text box </p>'
40+
},
41+
codeFiles: ['disabled.vue']
42+
},
3043
{
3144
demoId: 'show-password',
3245
name: {

packages/theme/src/textarea/index.less

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
&:before {
3232
content: '';
33-
width: calc(100% - 16px);
33+
width: calc(100% - 20px);
3434
height: 8px;
3535
position: absolute;
3636
left: 2px;
@@ -42,7 +42,7 @@
4242

4343
&:after {
4444
content: '';
45-
width: calc(100% - 19px);
45+
width: calc(100% - 20px);
4646
height: 16px;
4747
position: absolute;
4848
left: 2px;
@@ -63,6 +63,14 @@
6363
&.is-disabled {
6464
background-color: var(--ti-textarea-disabled-bg-color);
6565

66+
&:before {
67+
background-color: var(--ti-textarea-disabled-bg-color);
68+
}
69+
70+
&:after {
71+
background-color: var(--ti-textarea-disabled-bg-color);
72+
}
73+
6674
&:hover {
6775
border-color: var(--ti-textarea-border-color);
6876
}
@@ -175,9 +183,9 @@
175183

176184
&.is-display-only {
177185
.@{textarea-prefix-cls}-display-only.@{textarea-prefix-cls}__inner-con
178-
.@{textarea-prefix-cls}-display-only__content,
186+
.@{textarea-prefix-cls}-display-only__content,
179187
.@{textarea-prefix-cls}-autosize-display-only.@{textarea-prefix-cls}__inner-con
180-
.@{textarea-prefix-cls}-display-only__content {
188+
.@{textarea-prefix-cls}-display-only__content {
181189
position: relative;
182190
left: 0;
183191
max-width: 100%;

0 commit comments

Comments
 (0)