mirror of
https://gitee.com/lijingbo-2021/open-anylink-web.git
synced 2025-12-30 11:02:25 +00:00
切换录音时保存草稿
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { QuillEditor, Delta, Quill } from '@vueup/vue-quill'
|
||||
import '@vueup/vue-quill/dist/vue-quill.snow.css'
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { onMounted, onUnmounted, onBeforeUnmount, ref, watch } from 'vue'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { messageStore, imageStore } from '@/stores'
|
||||
import { ElMessage, ElLoading } from 'element-plus'
|
||||
@@ -36,6 +36,17 @@ onMounted(async () => {
|
||||
})
|
||||
})
|
||||
|
||||
onBeforeUnmount(async () => {
|
||||
let content = await getContent()
|
||||
// 草稿若没发生变动,则不触发存储
|
||||
if (content !== messageData.sessionList[props.sessionId].draft) {
|
||||
messageData.updateSession({
|
||||
sessionId: props.sessionId,
|
||||
draft: content
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (editorRef.value) {
|
||||
document.querySelector('.ql-editor').classList.remove('my-scrollbar')
|
||||
|
||||
Reference in New Issue
Block a user