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

怎么给网站做网站地图国内外知名市场调研公司

怎么给网站做网站地图,国内外知名市场调研公司,中国网站模板下载,视觉上体验的网站问题描述:默认情况下 vue-grid-layout 移动卡片到页面底部时页面滚动条并不会跟随卡片滚动。 问题解决: 在 grid-item中的move事件中,获取到当前移动的元素,并使用scrollIntoView方法来实现滚动条跟随。 代码如下: c…

问题描述:默认情况下 vue-grid-layout 移动卡片到页面底部时页面滚动条并不会跟随卡片滚动。

在这里插入图片描述

问题解决:

grid-item中的move事件中,获取到当前移动的元素,并使用scrollIntoView方法来实现滚动条跟随。
代码如下:

const moveEvent = (i: any) => {let cIdx = layout.value.findIndex(item => item.i === i)let el = gridItemRefs.value[cIdx].$elsetTimeout(() => {el?.scrollIntoView({ behavior: "smooth", block: "end" })}, 300)
}

此时优化效果如下:
在这里插入图片描述

  • 但是上面优化还有一个小问题,将卡片右移可以无效无限右移。
    所以根据元素的lastX来控制一下:
const moveEvent = (i: any) => {let cIdx = layout.value.findIndex(item => item.i === i)let el = gridItemRefs.value[cIdx].$elsetTimeout(() => {console.log(gridItemRefs.value[cIdx].lastX, '===gridItemRefs.value[cIdx]');if (gridItemRefs.value[cIdx].lastX < 900) {el?.scrollIntoView({ behavior: "smooth", block: "end" })}}, 300)
}

同理,如果是从外层拖到元素进来,也可以使用 scrollIntoView来设置滚动条跟随。
代码如下:
在这里插入图片描述

const colNum = 12
const drag = (item: any) => {let parentRect = document.getElementById('content')?.getBoundingClientRect()!;let mouseInGrid = false;if (((mouseXY.x > parentRect.left) && (mouseXY.x < parentRect.right)) && ((mouseXY.y > parentRect.top) && (mouseXY.y < parentRect.bottom))) {mouseInGrid = true;}if (mouseInGrid === true && (layout.value.findIndex(item => item.i === 'drop')) === -1) {layout.value.push({x: (layout.value.length * 2) % (colNum || 12),y: layout.value.length + (colNum || 12), // puts it at the bottomw: item.w,h: item.h,i: 'drop',});}let index = layout.value.findIndex(item => item.i === 'drop');if (index !== -1) {try {gridItemRefs.value[layout.value.length - 1].$refs.item.style.display = "none";} catch {}let el = gridItemRefs.value[index];if (el) {setTimeout(() => {el.$el?.scrollIntoView({ behavior: "smooth", block: "nearest" })}, 300)el.dragging = { "top": mouseXY.y - parentRect.top, "left": mouseXY.x - parentRect.left };let new_pos = el.calcXY(mouseXY.y - parentRect.top, mouseXY.x - parentRect.left);if (mouseInGrid === true) {gridlayout.value.dragEvent('dragstart', 'drop', new_pos.x || 0, new_pos.y || 0, item.h, item.w);// dragEvent('dragstart', 'drop', new_pos.x || 0, new_pos.y || 0, defaultH, defaultW);DragPos.i = String(new Date().getTime());DragPos.x = layout.value[index].x;DragPos.y = layout.value[index].y;DragPos.w = layout.value[index].w;DragPos.h = layout.value[index].h;}if (mouseInGrid === false) {gridlayout.value.dragEvent('dragend', 'drop', new_pos.x || 0, new_pos.y || 0, item.h, item.w);// dragEvent('dragend', 'drop', new_pos.x || 0, new_pos.y || 0, defaultH, defaultW);layout.value = layout.value.filter(obj => obj.i !== 'drop');}}}
}
const dragend = () => {let parentRect = document.getElementById('content')?.getBoundingClientRect()!;let mouseInGrid = false;if (((mouseXY.x > parentRect.left) && (mouseXY.x < parentRect.right)) && ((mouseXY.y > parentRect.top) && (mouseXY.y < parentRect.bottom))) {mouseInGrid = true;}if (mouseInGrid === true) {gridlayout.value.dragEvent('dragend', 'drop', DragPos.x, DragPos.y, DragPos.h, DragPos.w);let delIndex = layout.value.findIndex(item => item.i === 'drop')layout.value.splice(delIndex, 1)// UNCOMMENT below if you want to add a grid-itemlayout.value.push({x: DragPos.x,y: DragPos.y,w: DragPos.w,h: DragPos.h,i: DragPos.i,});gridlayout.value.dragEvent('dragend', DragPos.i, DragPos.x, DragPos.y, DragPos.h, DragPos.w);try {gridItemRefs.value[layout.value.length - 1].$refs.item.style.display = "block";} catch {}}
}
http://www.yayakq.cn/news/458549/

相关文章:

  • 网站搜索排优化怎么做网站备案更改网站负责人
  • opensns wordpress搜索引擎排名优化亚当
  • 教育类电商网站wordpress图片使用图床
  • 天津常规网站建设系列福建网站模板
  • 西安计算机培训机构哪个最好品牌推广百度seo
  • 做设计在哪个网站接单装修在线设计平台
  • 宜昌永东建设网站新网站收录多少关键词
  • 建设网站了还能消除吗互联网网站建设水平
  • 网站开发公司 logo个人网站备案需要多久
  • 个人网站建站指南万网网站电话
  • 内蒙古创意网站开发施工企业的维保技术方案
  • 网站推广服务方案南海建设工程交易中心网站
  • 网站登录入口大全it行业怎么入门
  • 小说阅读网站开发如何制作网页插件
  • 微信 公众号 微网站开发学做网站需要什么软件
  • 网站左侧分类菜单怎么做俄文视频网站开发
  • 怎么网站建设公司wordpress mu 安装
  • 上海外贸建站it运维管理系统
  • wordpress 整站模板dw做链接网站无法显示该页面
  • 宁波建设银行网站首页wordpress多媒体上传
  • 重庆巴南网站制作北京经济技术开发区建设局网站
  • 购物车网站建设网页设计一般一个月工资多少
  • 做的物流网站企业网站 flash
  • 国外扁平化网站设计欣赏叫企业做的网站可不可以自己改主题
  • 网站开发项目计划书ppt电子商务网站建设有管理课后答案
  • 女和男做的视频网站阿里云邮箱企业邮箱
  • 用html做网站搜索框阳江网商会
  • 高端响应式网站开发企业画册印刷
  • 信誉好的专业网站建设互联网与网站有哪些
  • 自己做的网站旅游网站建设 pig