Commit a8d78507 by 姜鹏凯

欢迎语支持换行

1 parent 2b230186
// 带 插入 表情/客户昵称 等扩展工具栏的文本内容框
<script>
export default {
name: '',
props: {
value: '',
// ['emoji','insertCustomerNickName']
toolbar: {
type: Array,
default: () => ['emoji'],
export default {
name: '',
props: {
value: '',
// ['emoji','insertCustomerNickName']
toolbar: {
type: Array,
default: () => ['emoji']
}
},
},
components: {
SelectEmoji: () => import('@/components/SelectEmoji'),
},
data() {
return {}
},
computed: {
proxyValue: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
},
components: {
SelectEmoji: () => import('@/components/SelectEmoji')
},
},
watch: {},
created() {},
mounted() {},
methods: {
// 插入内容
insertContent(value) {
const $textarea = this.$refs.textarea.$el.children[0]
const content = this.proxyValue || ''
const textIndex = $textarea.selectionStart
this.proxyValue = content.slice(0, textIndex) + value + content.slice(textIndex)
data() {
return {}
},
},
}
computed: {
proxyValue: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
watch: {},
created() {},
mounted() {},
methods: {
// 插入内容
insertContent(value) {
const $textarea = this.$refs.textarea.$el.children[0]
const content = this.proxyValue || ''
const textIndex = $textarea.selectionStart
this.proxyValue = content.slice(0, textIndex) + value + content.slice(textIndex)
}
}
}
</script>
<template>
......@@ -55,4 +55,8 @@ export default {
</div>
</template>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
textarea {
white-space: pre-wrap; //保留所有空格
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!