feat: 🚀 tabs增加滚动条

This commit is contained in:
2025-07-28 10:03:07 +08:00
parent b3bffac35e
commit 1a97f75546
6 changed files with 773 additions and 436 deletions

View File

@@ -76,6 +76,7 @@
@keydown.backspace.stop
v-else
v-model="item.title"
max-length=""
:ref="el => (editInputRefs[index] = el)"
size="small"
class="title-input"
@@ -113,7 +114,7 @@ import { QuillEditor, Quill } from "@vueup/vue-quill";
import "@vueup/vue-quill/dist/vue-quill.snow.css";
import { getCurrentInstance, reactive, ref, toRaw, computed, onMounted, nextTick } from "vue";
import { generateUUID } from "@/utils";
import { h } from "@/utils/url";
// import { h } from "@/utils/url";
import { routerObj } from "./utils.js";
import { titleConfig } from "./titleConfig.js";
import { uploadVideo, uploadImg } from "@/api/modules/upload";
@@ -307,7 +308,7 @@ const handleHttpUpload = async options => {
imageListDb.value.forEach(item => {
const length = quill.getLength() - 1;
quill.insertEmbed(length, "customImage", {
url: h + item.path,
url: item.path,
id: item.serverImgId || generateUUID()
});
quill.setSelection(length + 1);
@@ -346,7 +347,7 @@ const handleVideoUpload = async evt => {
let length = quill.selection.savedRange.index;
const { data } = await uploadVideo(formData);
quill.insertEmbed(length, "customVideo", {
url: h + data.path,
url: data.path,
id: generateUUID()
});
uploadFileVideo.value.value = "";
@@ -459,6 +460,7 @@ const handleQR = () => {
return useMsg("error", "标签页内容为空 !");
}
const range = quill.getSelection(true);
// 判断是否是编辑已有标签页(通过 currentEditingTabsRef 是否有值)
if (currentEditingTabsRef.value) {
// 1. 编辑模式:更新原有标签页组件
@@ -470,7 +472,10 @@ const handleQR = () => {
} else {
// 2. 新增模式:插入新的标签页组件
quill.insertEmbed(range.index, "tabs", tabsData.value);
// 关键:在标签页前方插入一个空段落(确保顶部有空间)
// quill.insertText(range.index, "\n"); // 插入换行
quill.setSelection(range.index + 1);
quill.insertText(range.index, "\n"); // 插入换行
}
// 关闭弹窗并清空临时数据
setTabsInfo();