83 lines
1.5 KiB
Vue
83 lines
1.5 KiB
Vue
<template>
|
|
<section class="AiTextarea" :class="{border}">
|
|
<u-input type="textarea" v-bind="$attrs" :value="value" :maxlength="maxlength"
|
|
@input="handleInput" :disabled="disabled"/>
|
|
<div class="bottomBar">
|
|
<div class="leftPane">
|
|
<slot name="bar"/>
|
|
</div>
|
|
<div v-if="!!maxlength">{{ value.length }}/{{ maxlength }}</div>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script>
|
|
import UInput from "../uview/components/u-input/u-input";
|
|
|
|
export default {
|
|
name: "AiTextarea",
|
|
components: {UInput},
|
|
model: {
|
|
prop: "value",
|
|
event: "change"
|
|
},
|
|
props: {
|
|
value: {default: ""},
|
|
maxlength: {default: 0},
|
|
border: Boolean,
|
|
disabled: Boolean
|
|
},
|
|
methods: {
|
|
handleInput(v) {
|
|
this.$emit('change', v)
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.AiTextarea {
|
|
width: 100%;
|
|
position: relative;
|
|
|
|
&.border {
|
|
::v-deep textarea {
|
|
border-radius: 4px;
|
|
border: 1px solid #e2e1e1;
|
|
padding: 16px 16px 36px;
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
.bottomBar {
|
|
position: absolute;
|
|
bottom: 8px;
|
|
right: 16px;
|
|
}
|
|
|
|
::v-deep .u-input__right-icon {
|
|
position: absolute;
|
|
top: 50%;
|
|
right: 16px;
|
|
transform: translateY(-50%);
|
|
}
|
|
}
|
|
|
|
.bottomBar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
min-height: 36px;
|
|
color: #999999;
|
|
|
|
.leftPane {
|
|
display: flex;
|
|
|
|
& > * + * {
|
|
margin-left: 32px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|