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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
| <template>
| <div class="web__msg" @keyup.enter="handleSend">
| <textarea v-model="currentMsg" rows="3" :placeholder="placeholder" class="web__msg-input"></textarea>
| <div class="web__msg-menu">
| <el-button class="web__msg-submit" type="primary" @click="handleSend">发送</el-button>
| </div>
| </div>
| </template>
|
| <script>
| export default {
| name: 'JwChat_enterbox',
| props: {
| placeholder: {
| type: String,
| default: '请输入内容...'
| },
| value: {
| default: ''
| }
| },
| data () {
| return {
| currentMsg: this.msg
| }
| },
| watch: {
| value: {
| handler () {
| this.currentMsg = this.value;
| },
| immediate: true
| },
| currentMsg: {
| handler (newval) {
| if (newval) {
| const msg = newval.trim()
| this.$emit('input', msg)
| }
| },
| immediate: true
| }
| },
| methods: {
| //用户主动发送
| handleSend () {
| this.$emit('submit', this.currentMsg);
| this.$nextTick(() => {
| this.currentMsg = ''
| })
| }
| },
| }
| </script>
| <style scoped>
| .web__msg {
| padding: 0 10px;
| height: auto;
| overflow: hidden;
| padding-top: 10px;
| }
| .web__msg--img,
| .web__msg--video,
| .web__msg--file {
| position: relative;
| max-width: 250px;
| min-width: 200px;
| width: 100%;
| margin: 10px 0;
| border: 1px solid #eee;
| overflow: hidden;
| border-radius: 5px;
| cursor: pointer;
| display: block;
| }
|
| .web__msg .web__msg {
| height: 150px;
| background-color: #fff;
| }
| .web__msg .web__msg span {
| box-sizing: border-box;
| padding: 3px 5px;
| color: #333;
| display: flex;
| align-items: center;
| width: 100%;
| justify-content: center;
| height: calc(100% - 80px);
| overflow: hidden;
| font-size: 13px;
| text-align: center;
| }
|
| .web__msg .web__msg h2 {
| margin: 0;
| width: 100%;
| text-align: center;
| line-height: 80px;
| background-color: #409eff;
| color: #fff;
| }
|
| .web__msg--map {
| height: 160px;
| }
|
| .web__msg-input {
| display: block;
| width: 100%;
| height: 60px;
| overflow-x: hidden;
| overflow-y: auto;
| box-sizing: border-box;
| resize: none;
| outline: 0;
| background-color: #fff;
| border: 0;
| word-break: break-all;
| font-size: 20px;
| line-height: 17px;
| -webkit-appearance: none;
|
| }
| .web__msg-menu {
| text-align: right;
| }
| .web__msg-submit {
| display: inline-block;
| outline: none;
| cursor: pointer;
| text-align: center;
| }
| </style>
|
|