当前位置: 首页 > wzjs >正文

网站电子签名怎么做中国企业资讯网

网站电子签名怎么做,中国企业资讯网,长春seo排名优化,舒兰市城乡建设局网站这个甘特图之前插件里,没有找到能固定label标签在屏幕上的办法,用css各种办法都没有实现,所以我我直接手写定位,用js监听滚动条滚动的距离,然后同步移动甘特图label标签,造成一种定位的错觉,以下…

这个甘特图之前插件里,没有找到能固定label标签在屏幕上的办法,用css各种办法都没有实现,所以我我直接手写定位,用js监听滚动条滚动的距离,然后同步移动甘特图label标签,造成一种定位的错觉,以下是代码:

我用的是介绍 | Pure Admin 保姆级文档(已更新至最新版v6.0.0)这个前端框架,感觉功能还是非常完善的,作者全职做开源,希望大家也多多支持。

这个是全部甘特图的示例代码

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from "vue";
// https://zunnzunn.github.io/vue-ganttastic/introduction.html
import { GGanttChart, GGanttRow } from "@infectoone/vue-ganttastic";// 添加滚动位置状态
const scrollLeft = ref(0);
// 添加容器引用
const containerRef = ref(null);// 现有数据保持不变
const context = ref([[{week: "星期一",beginDate: "06:00",endDate: "22:00",label_column_title: "123",ganttBarConfig: {id: "0",hasHandles: true,label: "需求收集和分析  负责人:小张",style: {background: "#e96560"}}}],[{week: "星期二",beginDate: "09:00",endDate: "18:00",ganttBarConfig: {id: "1",hasHandles: true,label: "系统设计  负责人:小强",style: {background: "#5ccfa3"}}}],[{week: "星期三",beginDate: "07:00",endDate: "20:00",ganttBarConfig: {id: "2",hasHandles: true,label: "编码实现  负责人:老李",style: {background: "#77d6fa"}}}],[{week: "星期四",beginDate: "06:00",endDate: "21:00",ganttBarConfig: {id: "3",hasHandles: true,label: "编码实现  负责人:小明",style: {color: "#fff",background: "#1b2a47"}}}],[{week: "星期五",beginDate: "05:00",endDate: "19:00",ganttBarConfig: {id: "4",hasHandles: true,label: "内部测试  负责人:小雪",style: {background: "#5ccfa3"}}}],[{week: "星期六",beginDate: "10:00",endDate: "22:00",ganttBarConfig: {id: "5",hasHandles: true,label: "系统优化和文档整理  负责人:小欣",style: {background: "#f8bc45"}}}],[{week: "星期天",beginDate: "04:00",endDate: "23:59",ganttBarConfig: {id: "6",immobile: false,hasHandles: false,label: "部署和上线  负责人:老王",style: {background: "#f3953d"}}}],[{week: "星期天",beginDate: "04:00",endDate: "23:59",ganttBarConfig: {id: "6",immobile: false,hasHandles: false,label: "部署和上线  负责人:老王",style: {background: "#f3953d"}}}]
]);// 滚动事件处理函数
function handleScroll(e) {scrollLeft.value = e.target.scrollLeft;console.log("滚动事件触发", scrollLeft.value);const labels = document.querySelectorAll(".g-gantt-row-label, .g-gantt-row-label-container");labels.forEach(label => {label.style.position = "absolute";label.style.left = scrollLeft.value + "px";});
}// 添加和移除滚动事件监听
onMounted(() => {// 延迟添加事件监听,确保DOM已完全渲染setTimeout(() => {if (containerRef.value) {containerRef.value.addEventListener("scroll", handleScroll);console.log("滚动监听已添加", containerRef.value);}}, 500);
});onUnmounted(() => {if (containerRef.value) {containerRef.value.removeEventListener("scroll", handleScroll);console.log("滚动监听已移除");}
});function getWeekRange() {const today = new Date();const dayOfWeek = today.getDay();const startDate = new Date(today);startDate.setDate(today.getDate() - dayOfWeek + 1);const endDate = new Date(startDate);endDate.setDate(startDate.getDate() + 6);const formatDate = date => {const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, "0");const day = String(date.getDate()).padStart(2, "0");return `${year}-${month}-${day}`;};const currentWeekStart = formatDate(startDate);const currentWeekEnd = formatDate(endDate);return {currentWeekStart,currentWeekEnd};
}const weekRangeInChina = getWeekRange();
</script><template><div ref="containerRef" class="gantt-container"><g-gantt-chartchart-start="00:00"chart-end="23:59"precision="hour"date-format="HH:mm"bar-start="beginDate"bar-end="endDate"gridclass="full-width-gantt"><template #upper-timeunit><h1>{{`${weekRangeInChina.currentWeekStart} / ${weekRangeInChina.currentWeekEnd}`}}</h1></template><g-gantt-rowv-for="(item, index) in context":key="index":bars="item":label="item[0].week"highlight-on-hover/></g-gantt-chart></div>
</template><style>
/* 全局样式,确保能覆盖组件内部样式 */
.g-gantt-row-label,
.g-gantt-row-label-container {position: relative !important;transition: none !important;
}.gantt-container {width: 100%;overflow-x: auto;padding-bottom: 10px;
}.full-width-gantt {min-width: 1500px;width: 200%;
}/* 修改标签宽度样式 */
.g-gantt-row-label {width: 100px !important;min-width: 100px !important;max-width: 100px !important;box-sizing: border-box !important;overflow: hidden !important;text-overflow: ellipsis !important;
}
</style>

重点处理方法是:

// 添加滚动位置状态
const scrollLeft = ref(0);
// 添加容器引用
const containerRef = ref(null);// 添加和移除滚动事件监听
onMounted(() => {// 延迟添加事件监听,确保DOM已完全渲染setTimeout(() => {if (containerRef.value) {containerRef.value.addEventListener("scroll", handleScroll);console.log("滚动监听已添加", containerRef.value);}}, 500);
});// 滚动事件处理函数
function handleScroll(e) {scrollLeft.value = e.target.scrollLeft;console.log("滚动事件触发", scrollLeft.value);const labels = document.querySelectorAll(".g-gantt-row-label, .g-gantt-row-label-container");labels.forEach(label => {label.style.position = "absolute";label.style.left = scrollLeft.value + "px";});
}
onUnmounted(() => {if (containerRef.value) {containerRef.value.removeEventListener("scroll", handleScroll);console.log("滚动监听已移除");}
});


文章转载自:

http://oLYWvdJi.wmmtL.cn
http://4AzmVmEI.wmmtL.cn
http://TyZLlyQ8.wmmtL.cn
http://ZFs3Cz8B.wmmtL.cn
http://o5tH412F.wmmtL.cn
http://Ad8rUZtd.wmmtL.cn
http://IAoX3jzi.wmmtL.cn
http://asCwwDgP.wmmtL.cn
http://JqSvIbmb.wmmtL.cn
http://Ju51J5TF.wmmtL.cn
http://HlBWPeM8.wmmtL.cn
http://z9WClnYN.wmmtL.cn
http://nykohDCo.wmmtL.cn
http://YkyR7tDd.wmmtL.cn
http://bwsuNVEw.wmmtL.cn
http://rlUnK2X4.wmmtL.cn
http://MmGBNvbD.wmmtL.cn
http://YiVlIG8i.wmmtL.cn
http://PacQtXM6.wmmtL.cn
http://gGVfo05G.wmmtL.cn
http://TX9x5UlA.wmmtL.cn
http://Jnkx9NTZ.wmmtL.cn
http://G5yKI1aM.wmmtL.cn
http://gVQIuXMF.wmmtL.cn
http://OlvCA0IR.wmmtL.cn
http://OxpYhCEs.wmmtL.cn
http://ElAxRFxp.wmmtL.cn
http://kzV5u1AM.wmmtL.cn
http://3OkcEMLI.wmmtL.cn
http://qI7ufiUM.wmmtL.cn
http://www.dtcms.com/wzjs/723771.html

相关文章:

  • 个人网站推广 公司用织梦做企业网站
  • 接入服务商网站备案管理系统技术规范要求如何开网店详细步骤
  • 自己搭建的网站可以收费吗机械加工网入网
  • 做网店在素材网站找的图侵权吗企业网站建设东莞
  • 网站屏幕自适应代码建设邮费自己的网站 要不要购买服务器的
  • 福州市网站网站如何不被百度搜到
  • dedecms企业网站建设部注册网站
  • 青岛手机网站制作18款未成年禁用软件app
  • 稳定的常州网站推广四川省建设网招标公告
  • 石家庄行业网站网站建设不完整(网站内容太少)
  • 购物网站 系统设计中国建设银行网站运营模式
  • 网站建设学校常用的网站有哪些
  • 电子商务网站建设实训wordpress 插件管理
  • 想要一个网站哪家云服务器性价比高
  • 泉山微网站开发北京王府井大楼
  • 中国建设银行建银购网站赞赏分享wordpress代码
  • .net 网站模板下载地址做网站一定需要服务器吗
  • 外国语学院英文网站建设电子商务网站建设方
  • 婚礼纪网站怎么做请帖无锡工业设计公司
  • 网站基础设施建设土木英才网招聘信息
  • 做摄影和后期的兼职网站我们的优势的网站
  • 公司做网站的开支会计分录怎么做皮肤科医生免费问诊
  • 旅游网站对比模板下载深圳定制巴士线路查询
  • 深圳送花网站哪个好网站搭建 虚拟空间
  • 做网站是先做后台还是前端百度推广 网站吸引力
  • 网站建设质量要求库存管理系统软件
  • 国家城乡建设网站网站优化与seo
  • 网站建设系统规划动漫模板素材
  • 网站建设参考wordpress萧涵主题
  • 网站开发用笔记本电脑网上做任务的网站有哪些