|
@@ -1,54 +1,55 @@
|
|
|
<template>
|
|
|
- <div style="padding: 22px 18px;">
|
|
|
- <div class="space_between_in card_add_page_title" @click="addPage">
|
|
|
- <span>页面</span>
|
|
|
- <el-icon color="#337ecc">
|
|
|
- <Plus />
|
|
|
- </el-icon>
|
|
|
- </div>
|
|
|
- <div style="width: 100%;" v-for="(item, index) in listTabs" :key="index">
|
|
|
- <el-popover :ref="setPopoverRef" :visible="item.visible" placement="right" :width="160"
|
|
|
- @visible-change="handleVisibleChange">
|
|
|
- <div class="card_right_click">
|
|
|
- <div class="title_right" @click.stop="editTitle(item)">
|
|
|
- <div class="icon_right_click">
|
|
|
- <el-icon>
|
|
|
- <EditPen />
|
|
|
- </el-icon>
|
|
|
+ <el-scrollbar noresize view-class="head_page_scrollber">
|
|
|
+ <div class="additionpage_head">
|
|
|
+ <div class="tabs_item_page" v-for="(item, index) in listTabs" :key="index">
|
|
|
+ <el-popover :ref="setPopoverRef" :visible="item.visible" placement="bottom" :width="160"
|
|
|
+ @visible-change="handleVisibleChange">
|
|
|
+ <div class="card_right_click">
|
|
|
+ <div class="title_right" @click.stop="editTitle(item)">
|
|
|
+ <div class="icon_right_click">
|
|
|
+ <el-icon>
|
|
|
+ <EditPen />
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
+ <span>编辑标题</span>
|
|
|
</div>
|
|
|
- <span>编辑标题</span>
|
|
|
- </div>
|
|
|
- <div class="title_right" @click.stop="deletePage(item)" v-if="item.name != '首页' && item.name != '卡片'">
|
|
|
- <div class="icon_right_click">
|
|
|
- <el-icon>
|
|
|
- <Delete />
|
|
|
- </el-icon>
|
|
|
+ <div class="title_right" @click.stop="deletePage(item)"
|
|
|
+ v-if="item.name != '首页' && item.name != '卡片'">
|
|
|
+ <div class="icon_right_click">
|
|
|
+ <el-icon>
|
|
|
+ <Delete />
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
+ <span>删除</span>
|
|
|
</div>
|
|
|
- <span>删除</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <template #reference>
|
|
|
- <div :class="[item.flag ? 'active_card_page' : '', !item.inputFlag ? 'item_tabs_page' : 'edit_card_page']"
|
|
|
- @click="getTabs(item)" @contextmenu.stop="onContextMenu($event, item)">
|
|
|
- <div style="display: flex;align-items: center;" v-if="!item.inputFlag"
|
|
|
+ <template #reference>
|
|
|
+ <div :class="[item.flag ? 'active_card_page' : '', !item.inputFlag ? 'item_tabs_page' : 'edit_card_page']"
|
|
|
+ @click="getTabs(item)" @contextmenu.stop="onContextMenu($event, item)"
|
|
|
@dblclick="handleDoubleClick(item)">
|
|
|
- <span class="iconfont page_icon_img" :style="{ color: (item.flag ? '#409EFF' : '') }"
|
|
|
- :class="item.icon" v-if="item.icon"></span>
|
|
|
- <span>{{ item.name }}</span>
|
|
|
+ <div style="display: flex;align-items: center;" v-if="!item.inputFlag">
|
|
|
+ <span class="iconfont page_icon_img" :style="{ color: (item.flag ? '#409EFF' : '') }"
|
|
|
+ :class="item.icon" v-if="item.icon"></span>
|
|
|
+ <span>{{ item.name }}</span>
|
|
|
+ </div>
|
|
|
+ <input v-if="editIndex === index && item.inputFlag" :ref="setInputRef" class="title_input_edit"
|
|
|
+ v-model="item.name" type="text" @input="handleInput" @blur="handleBlur">
|
|
|
</div>
|
|
|
- <input v-if="editIndex === index && item.inputFlag" :ref="setInputRef" class="title_input_edit"
|
|
|
- v-model="item.name" type="text" @input="handleInput" @blur="handleBlur">
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-popover>
|
|
|
+ </div>
|
|
|
+ <div class="space_between_in card_add_page_title" @click="addPage">
|
|
|
+ <el-icon color="#ffffff" size="22px">
|
|
|
+ <Plus />
|
|
|
+ </el-icon>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </el-scrollbar>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ElPopover, ElMessageBox } from 'element-plus';
|
|
|
import { ref, onMounted, onBeforeUnmount } from "vue";
|
|
|
-
|
|
|
import { useUserStore } from '../stores/index'
|
|
|
import { storeToRefs } from 'pinia';
|
|
|
const storeUser = useUserStore()
|
|
@@ -91,6 +92,7 @@ function handleDoubleClick(params: any) {
|
|
|
setTimeout(() => {
|
|
|
if (inputRef.value) {
|
|
|
inputRef.value.focus();
|
|
|
+ inputRef.value.select();
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
@@ -108,6 +110,7 @@ function editTitle(params: any) {
|
|
|
setTimeout(() => {
|
|
|
if (inputRef.value) {
|
|
|
inputRef.value.focus();
|
|
|
+ inputRef.value.select();
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
@@ -158,6 +161,7 @@ function addPage() {
|
|
|
visible: false,
|
|
|
inputFlag: false,
|
|
|
name: '未命名 ' + (listTabs.value.length + 1),
|
|
|
+ viewData: [],
|
|
|
}
|
|
|
listTabs.value.push(arrList)
|
|
|
}
|
|
@@ -199,10 +203,39 @@ const handleClickOutside = (event: MouseEvent) => {
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.additionpage_head {
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.scrollbar-flex-content {
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.head_page_scrollber) {
|
|
|
+ height: 100% !important;
|
|
|
+}
|
|
|
+
|
|
|
+.additionpage_head {
|
|
|
+ padding: 0px 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.tabs_item_page {
|
|
|
+ margin-right: 10px;
|
|
|
+ width: 100px;
|
|
|
+ flex: none;
|
|
|
+ flex-shrink: 0;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 5px;
|
|
|
+}
|
|
|
+
|
|
|
.card_add_page_title {
|
|
|
cursor: pointer;
|
|
|
- padding: 0px 5px;
|
|
|
- margin-bottom: 22px;
|
|
|
+ padding: 4px;
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px solid #CDD0D6;
|
|
|
+ background-color: #dedfe0;
|
|
|
|
|
|
span {
|
|
|
font-size: 14px;
|
|
@@ -210,6 +243,11 @@ const handleClickOutside = (event: MouseEvent) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+.card_add_page_title:hover {
|
|
|
+ border: 1px solid rgba(15, 115, 230, 0.08);
|
|
|
+ background-color: rgba(15, 115, 230, 0.08);
|
|
|
+}
|
|
|
+
|
|
|
.card_right_click {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
@@ -283,8 +321,13 @@ const handleClickOutside = (event: MouseEvent) => {
|
|
|
.page_icon_img {
|
|
|
position: absolute;
|
|
|
left: 5px;
|
|
|
- font-size: 13px;
|
|
|
+ top: 0;
|
|
|
+ bottom: 0;
|
|
|
+ font-size: 15px;
|
|
|
color: #606266;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
.title_input_edit {
|