my-textarea.vue
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<template>
<view class="r-top">
<textarea :maxlength="len" @input="changeContent" placeholder-style="color:#C8C9CC;" v-model="content" :placeholder="pl" :style="{height:textAreaH}"/>
<view class="r-top-t">
<view></view>
<view> {{contentLength}}/{{len}}</view>
</view>
</view>
</template>
<script>
export default {
computed:{
contentLength(){
return this.content.length;
}
},
props:{
pl:{
type: String,
default: "请输入"
},
contentTxt:{
type: String,
},
len:{
type: Number,
default: 200
},
textAreaH:{
type: String,
default: "160rpx"
}
},
watch:{
contentTxt(){
this.content = this.contentTxt
}
},
data() {
return {
content:this.contentTxt
}
},
methods:{
changeContent(){
this.$emit('changeContent',this.content)
}
}
}
</script>
<style>
.r-top{
border-radius: 20rpx;
}
.r-top textarea{width: 100%;padding-bottom: 10rpx;font-size: 32rpx;}
.r-top-t{
display: flex;
justify-content: space-between;
font-family:PingFang SC;
font-weight:400;
line-height:20px;
color:rgba(153,153,153,1);
opacity:1;
color: #c8c9cc;
}
</style>