Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions examples/sites/demos/pc/app/input/disabled-composition-api.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<div class="demo-input">
<tiny-input v-model="input" disabled placeholder="input"></tiny-input>
<tiny-input type="textarea" disabled v-model="input" placeholder="textarea"></tiny-input>
</div>
</template>

<script setup>
import { ref } from 'vue'
import { Input as TinyInput } from '@opentiny/vue'

const input = ref('')
</script>

<style scoped>
.demo-input {
width: 300px;
}

.demo-input > div {
margin-top: 10px;
}
</style>
11 changes: 11 additions & 0 deletions examples/sites/demos/pc/app/input/disabled.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test'

test('disabled', async ({ page }) => {
page.on('pageerror', (exception) => expect(exception).toBeNull())
await page.goto('input#disabled')
const demo = page.locator('#disabled')
const input = demo.getByRole('textbox', { name: 'input' })
const textarea = page.getByRole('textbox', { name: 'textarea' })
await expect(input).toHaveAttribute('disabled', '')
await expect(textarea).toHaveAttribute('disabled', '')
})
31 changes: 31 additions & 0 deletions examples/sites/demos/pc/app/input/disabled.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div class="demo-input">
<tiny-input v-model="input" disabled placeholder="input"></tiny-input>
<tiny-input type="textarea" disabled v-model="input" placeholder="textarea"></tiny-input>
</div>
</template>

<script>
import { Input } from '@opentiny/vue'

export default {
components: {
TinyInput: Input
},
data() {
return {
input: ''
}
}
}
</script>

<style scoped>
.demo-input {
width: 300px;
}

.demo-input > div {
margin-top: 10px;
}
</style>
13 changes: 13 additions & 0 deletions examples/sites/demos/pc/app/input/webdoc/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ export default {
},
codeFiles: ['clearable.vue']
},
{
demoId: 'disabled',
name: {
'zh-CN': '禁用',
'en-US': 'Disabled'
},
desc: {
'zh-CN': '<p>可通过 <code>disabled</code> 属性设置输入框的禁用状态。</p>',
'en-US':
'<p>You can set the <code>clearable</code> attribute to display the clear icon button in the text box </p>'
},
codeFiles: ['disabled.vue']
},
{
demoId: 'show-password',
name: {
Expand Down
16 changes: 12 additions & 4 deletions packages/theme/src/textarea/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

&:before {
content: '';
width: calc(100% - 16px);
width: calc(100% - 20px);
height: 8px;
position: absolute;
left: 2px;
Expand All @@ -42,7 +42,7 @@

&:after {
content: '';
width: calc(100% - 19px);
width: calc(100% - 20px);
height: 16px;
position: absolute;
left: 2px;
Expand All @@ -63,6 +63,14 @@
&.is-disabled {
background-color: var(--ti-textarea-disabled-bg-color);

&:before {
background-color: var(--ti-textarea-disabled-bg-color);
}

&:after {
background-color: var(--ti-textarea-disabled-bg-color);
}

&:hover {
border-color: var(--ti-textarea-border-color);
}
Expand Down Expand Up @@ -175,9 +183,9 @@

&.is-display-only {
.@{textarea-prefix-cls}-display-only.@{textarea-prefix-cls}__inner-con
.@{textarea-prefix-cls}-display-only__content,
.@{textarea-prefix-cls}-display-only__content,
.@{textarea-prefix-cls}-autosize-display-only.@{textarea-prefix-cls}__inner-con
.@{textarea-prefix-cls}-display-only__content {
.@{textarea-prefix-cls}-display-only__content {
position: relative;
left: 0;
max-width: 100%;
Expand Down