This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复readonly/disabled属性设置

old
宇天 2021-04-26 11:38:54 +08:00
parent 59076f2c54
commit 4f4cac8ddc
6 changed files with 19 additions and 16 deletions

View File

@ -343,8 +343,8 @@ export default class Input {
props = {
value: '',
placeholder: '',
maxlength: null,
minlength: null,
maxlength: 0,
minlength: 0,
clearable: false,
autofocus: false,
readonly: false,
@ -608,7 +608,7 @@ export default class Input {
break
case 'value':
this.value = val
this.value = val || ''
break
case 'maxlength':

View File

@ -170,19 +170,19 @@
}
// -------
:host([type='default']) {
:host([type='help']) {
color: var(--color-grey-2);
&::after {
border-color: var(--color-grey-1);
}
}
:host([type='default']:not([disabled]):hover) {
:host([type='help']:not([disabled]):hover) {
color: var(--color-grey-1);
}
:host([type='default']:not([disabled]):active) {
:host([type='help']:not([disabled]):active) {
color: var(--color-grey-3);
}
:host([type='default']:not([disabled]):focus-within) {
:host([type='help']:not([disabled]):focus-within) {
box-shadow: 0 0 0 2px var(--color-grey-a);
}
</style>

View File

@ -424,7 +424,7 @@ export default class Number {
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
this[k] = val !== null
break
}
}

View File

@ -494,7 +494,7 @@ export default class Select {
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
this[k] = val !== null
break
}
}

View File

@ -189,8 +189,9 @@ export default class Switch {
switch (name) {
case 'checked':
case 'disabled':
this[name] = true
this[name] = val !== null
break
case 'active-text':
case 'inactive-text':
console.log('------------->>>')

View File

@ -1,7 +1,7 @@
<template>
<div class="label">
<textarea spellcheck="false"></textarea>
<div class="input-stat">0/100</div>
<div class="input-stat">0/</div>
</div>
</template>
@ -139,8 +139,8 @@ export default class Textarea {
props = {
value: '',
placeholder: '',
maxlength: null,
minlength: null,
maxlength: 0,
minlength: 0,
autofocus: false,
readonly: false,
disabled: false,
@ -268,17 +268,19 @@ export default class Textarea {
break
case 'value':
this.value = val
this.value = val || ''
break
case 'maxlength':
case 'minlength':
if (val === null) {
this.__INPUT__.removeAttribute(name)
this.props[name] = 0
} else {
let n = +val
if (n > 0) {
this.__INPUT__.setAttribute(name, +val)
this.__INPUT__.setAttribute(name, n)
this.props[name] = n
}
}
break
@ -293,7 +295,7 @@ export default class Textarea {
if (k === 'readonly') {
k = 'readOnly'
}
this[k] = true
this[k] = val !== null
break
}
}