Merge branch 'master' of github.com:9th-js/wcui
commit
341f096b76
|
@ -20,7 +20,7 @@
|
||||||
- [ ] `wc-avatar`头像组件
|
- [ ] `wc-avatar`头像组件
|
||||||
- [x] `wc-badge`徽标组件
|
- [x] `wc-badge`徽标组件
|
||||||
- [x] `wc-drawer`抽屉组件
|
- [x] `wc-drawer`抽屉组件
|
||||||
- [ ] `wc-collapse`折叠组件
|
- [x] `wc-collapse`折叠组件
|
||||||
- [ ] `wc-counter`倒计时组件
|
- [ ] `wc-counter`倒计时组件
|
||||||
- [ ] `wc-drag`拖拽组件
|
- [ ] `wc-drag`拖拽组件
|
||||||
- [x] `wc-image`图片组件
|
- [x] `wc-image`图片组件
|
||||||
|
|
|
@ -11,12 +11,13 @@ class TextArea extends Component {
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
attributes: false
|
attribute: false
|
||||||
},
|
},
|
||||||
type: '',
|
type: '',
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
readOnly: false,
|
readOnly: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
autosize: false,
|
||||||
maxlength: null,
|
maxlength: null,
|
||||||
minlength: null,
|
minlength: null,
|
||||||
'show-limit': false,
|
'show-limit': false,
|
||||||
|
@ -29,7 +30,7 @@ class TextArea extends Component {
|
||||||
:host {
|
:host {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 80px;
|
min-height: 80px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
color: var(--color-dark-1);
|
color: var(--color-dark-1);
|
||||||
|
@ -37,11 +38,13 @@ class TextArea extends Component {
|
||||||
cursor: text;
|
cursor: text;
|
||||||
transition: box-shadow 0.15s linear;
|
transition: box-shadow 0.15s linear;
|
||||||
}
|
}
|
||||||
|
:host([autosize]) textarea {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
.label {
|
.label {
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
min-height: 100%;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border: 1px solid var(--color-grey-2);
|
border: 1px solid var(--color-grey-2);
|
||||||
border-radius: inherit;
|
border-radius: inherit;
|
||||||
|
@ -153,6 +156,13 @@ class TextArea extends Component {
|
||||||
]
|
]
|
||||||
onInput(e) {
|
onInput(e) {
|
||||||
this.value = e.target.value
|
this.value = e.target.value
|
||||||
|
if (this.autosize) {
|
||||||
|
nextTick(() => {
|
||||||
|
this.$refs.textarea.style.height = 'auto'
|
||||||
|
let height = this.$refs.textarea.scrollHeight + 'px'
|
||||||
|
this.$refs.textarea.style.height = height
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onKeydown(ev) {
|
onKeydown(ev) {
|
||||||
// console.log(ev.target)
|
// console.log(ev.target)
|
||||||
|
|
Loading…
Reference in New Issue