From 009b17c91d34ca833276f11e5e27304d693cd43a Mon Sep 17 00:00:00 2001 From: Lemon <1599456917@qq.com> Date: Sat, 22 Feb 2025 19:56:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E7=A6=BB=E4=B8=8A=E4=B8=8B=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=8C=89=E9=92=AE=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.local | 2 +- src/components/ScrollButtons/index.vue | 119 ++++++++++++++++++ .../bpm/model/CategoryDraggableModel.vue | 115 +---------------- 3 files changed, 124 insertions(+), 112 deletions(-) create mode 100644 src/components/ScrollButtons/index.vue diff --git a/.env.local b/.env.local index 35765584d..cfecf563f 100644 --- a/.env.local +++ b/.env.local @@ -4,7 +4,7 @@ NODE_ENV=development VITE_DEV=true # 请求路径 -VITE_BASE_URL='http://localhost:48080' +VITE_BASE_URL='http://192.168.3.9:48080' # 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务 VITE_UPLOAD_TYPE=server diff --git a/src/components/ScrollButtons/index.vue b/src/components/ScrollButtons/index.vue new file mode 100644 index 000000000..58afca3d4 --- /dev/null +++ b/src/components/ScrollButtons/index.vue @@ -0,0 +1,119 @@ + + + + + \ No newline at end of file diff --git a/src/views/bpm/model/CategoryDraggableModel.vue b/src/views/bpm/model/CategoryDraggableModel.vue index 5f195b46a..d2f294c6f 100644 --- a/src/views/bpm/model/CategoryDraggableModel.vue +++ b/src/views/bpm/model/CategoryDraggableModel.vue @@ -259,27 +259,8 @@ - -
-
- - - -
-
- - - -
-
+ + @@ -300,6 +281,7 @@ import { useDebounceFn } from '@vueuse/core' import { subString } from '@/utils/index' import { ArrowUpBold, ArrowDownBold } from '@element-plus/icons-vue' import { ElBacktop } from 'element-plus' +import ScrollButtons from '@/components/ScrollButtons/index.vue' defineOptions({ name: 'BpmModel' }) @@ -635,62 +617,6 @@ watchEffect(() => { isExpand.value = false } }) - -// 添加顶部按钮显示控制 -const showTopBtn = ref(false) - -// 控制底部按钮显示 -const showBottomBtn = ref(false) - -// 修改滚动事件处理 -const handleScroll = () => { - const container = document.querySelector('.form-detail-container') - if (container) { - const { scrollTop, scrollHeight, clientHeight } = container - // 当滚动到一定距离时显示顶部按钮 - showTopBtn.value = scrollTop > 100 - // 当未滚动到底部时显示底部按钮 - showBottomBtn.value = scrollTop + clientHeight < scrollHeight - 10 - } -} - -// 添加滚动到顶部方法 -const scrollToTop = () => { - const container = document.querySelector('.form-detail-container') - if (container) { - container.scrollTo({ - top: 0, - behavior: 'smooth' - }) - } -} - -// 添加滚动到底部方法 -const scrollToBottom = () => { - const container = document.querySelector('.form-detail-container') - if (container) { - container.scrollTo({ - top: container.scrollHeight, - behavior: 'smooth' - }) - } -} - -// 在组件挂载后添加滚动监听 -onMounted(() => { - const container = document.querySelector('.form-detail-container') - if (container) { - container.addEventListener('scroll', handleScroll) - } -}) - -// 在组件卸载前移除滚动监听 -onUnmounted(() => { - const container = document.querySelector('.form-detail-container') - if (container) { - container.removeEventListener('scroll', handleScroll) - } -})