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

饥荒网站这么做朔州seo

饥荒网站这么做,朔州seo,如何自建网页,福州做网站哪家公司好切换效果 页面结构变化 1.需求背景 项目首页存有一个小的轮播模块,保密原因大概只能这么展示,左侧图片右侧文字,后端一次性返回几百条数据(开发环境下,生产环境只会更多).无法使用分页解决,前端需要懒加载防止页面卡顿 写个小demo演示,如下 2.解决思路 获取到数据后,取第一…

切换效果

页面结构变化

1.需求背景

项目首页存有一个小的轮播模块,保密原因大概只能这么展示,左侧图片右侧文字,后端一次性返回几百条数据(开发环境下,生产环境只会更多).无法使用分页解决,前端需要懒加载防止页面卡顿
在这里插入图片描述
写个小demo演示,如下
在这里插入图片描述

2.解决思路

获取到数据后,取第一条数据展示.切换时,这里以查看下一张为例演示.切换下一张时,动态创建一个dom元素,通过字符串的方式设置innerHtml,将下一张的dom元素插入父节点.

同时父元素的第一个子元素(初始展示第一条数据的dom元素)和新创建的展示下一条数据的dom元素同时向左偏移自身宽度,然后把切走的dom元素清除,实现切换效果,同时避免页面大量结构堆积

3.代码如下

仅做了’下一张’功能,其他请自行补充

<template><div class="container"><button @click="golast">上一张</button><button @click="gonext">下一张</button><div class="windows"><div class="scrollBox"><div class="scrollItem"><div class="img"><el-image :src="initialData.imgUrl"></el-image></div><div class="messBox">{{ initialData.mess }}</div></div></div></div></div>
</template>
<script>
export default {data () {return {localData: [{ imgUrl: '../assets/xxx.png', mess: '11111' },{ imgUrl: '../assets/xxx.png', mess: '22222' },{ imgUrl: '../assets/xxx.png', mess: '33333' },{ imgUrl: '../assets/xxx.png', mess: '44444' },{ imgUrl: '../assets/xxx.png', mess: '55555' },{ imgUrl: '../assets/xxx.png', mess: '66666' },],initialData: '', // 初始展示数据nowIndex: 0// 当前展示数据的索引}},created () {},mounted () {this.initData()},computed: {},methods: {initData () {// 初始副职this.initialData = this.localData[this.nowIndex]},// 点击查看上一张golast () {},// 点击查看下一张gonext () {if (this.localData.length <= this.nowIndex + 1) returnthis.readyBox('next')const fatherDom = document.querySelector('.windows')const moveDistanceX = fatherDom.offsetWidthconst domArr = fatherDom.querySelectorAll('.scrollBox')// 这里判断.初始结构和动态创建的元素的初始位置不同,导致偏移时的数值是不同的if (!domArr[0].classList.contains('newScrollBox')) {domArr[0].style.transform = `translate(-${moveDistanceX}px,0px)`} else {domArr[0].style.transform = `translate(-${moveDistanceX * 2}px,0px)`}domArr[1].style.transform = `translateX(-${moveDistanceX}px)`this.nowIndex++// 移除上一个dom元素const timeId1 = setTimeout(() => {fatherDom.removeChild(domArr[0])clearTimeout(timeId1)}, 501)},// 为下一次切换准备dom元素readyBox (type) {// 信息展示列表无数据或只有一条数据时,不执行if (this.localData.length <= 1) returnlet nextShowData = ''// 上一张或下一张要展示的数据const fatherDom = document.querySelector('.windows')// 获取父元素const newDom = document.createElement('div')// 创建新元素// 设置新元素的样式newDom.className = 'scrollBox'newDom.classList.add('newScrollBox')newDom.style.width = '100%'newDom.style.height = '100%'newDom.style.position = 'absolute'newDom.style.transition = 'all 0.5s'// 上一张if (type === 'last') {// 判断当前展示列表是否合法if (this.nowIndex - 1 < 0) returnnextShowData = this.localData[this.nowIndex - 1]//此处省略........,自行补充}//   下一张if (type === 'next') {// 判断当前展示列表是否合法if (this.localData.length <= this.nowIndex + 1) returnnextShowData = this.localData[this.nowIndex + 1]// 下一张的数据newDom.style.left = '100%'}// 新元素的内部结构const innerHtml = `<div class="scrollItem" style=" display: flex;  width: 100%; height: 100%; background-color: pink;"><div class="img" style="width:50%; height:100%" ><el-image src="${nextShowData.imgUrl}"></el-image></div><div class="messBox" style=" font-size: 16px; width:50%; height:100%; background-color: skyblue; ">${nextShowData.mess}</div></div>`// 插入子元素newDom.innerHTML = innerHtmlfatherDom.appendChild(newDom)}}
}
</script>
<style lang='scss' scoped>
.container {width: 100%;height: 100%;
}.container .windows {position: relative;left: 30%;font-size: 0px;overflow: hidden;width: 40%;height: 40%;border: 1px solid red;
}.scrollBox {position: absolute;width: 100%;height: 100%;transition: all 0.5s;
}.windows .scrollItem {display: flex;width: 100%;height: 100%;background-color: pink;
}.windows .scrollItem .img {width: 50%;height: 100%;
}.windows .messBox {font-size: 16px;width: 50%;height: 100%;background-color: skyblue;
}
</style>

文章转载自:
http://intramural.c7630.cn
http://riftless.c7630.cn
http://abuilding.c7630.cn
http://darbies.c7630.cn
http://yachtswoman.c7630.cn
http://lararium.c7630.cn
http://extricator.c7630.cn
http://chaff.c7630.cn
http://carmela.c7630.cn
http://carpet.c7630.cn
http://penal.c7630.cn
http://xylographer.c7630.cn
http://antisepsis.c7630.cn
http://laxly.c7630.cn
http://fruitcake.c7630.cn
http://pithiness.c7630.cn
http://metascience.c7630.cn
http://campcraft.c7630.cn
http://housefront.c7630.cn
http://hardy.c7630.cn
http://sofar.c7630.cn
http://praiseworthy.c7630.cn
http://racemism.c7630.cn
http://dearborn.c7630.cn
http://aguish.c7630.cn
http://innerve.c7630.cn
http://geodynamic.c7630.cn
http://dissuasion.c7630.cn
http://rodger.c7630.cn
http://deionization.c7630.cn
http://circassia.c7630.cn
http://conchiolin.c7630.cn
http://astronomical.c7630.cn
http://loutish.c7630.cn
http://narcoleptic.c7630.cn
http://abirritate.c7630.cn
http://recaption.c7630.cn
http://deutzia.c7630.cn
http://shingon.c7630.cn
http://endoscope.c7630.cn
http://orfe.c7630.cn
http://neurotoxin.c7630.cn
http://oversize.c7630.cn
http://osteosclerosis.c7630.cn
http://drakensberg.c7630.cn
http://horeb.c7630.cn
http://evangelism.c7630.cn
http://bursary.c7630.cn
http://negrito.c7630.cn
http://kiblah.c7630.cn
http://yemenite.c7630.cn
http://lamellibranchiate.c7630.cn
http://moorcock.c7630.cn
http://apostolic.c7630.cn
http://chassid.c7630.cn
http://clementine.c7630.cn
http://intrusive.c7630.cn
http://maskinonge.c7630.cn
http://acyloin.c7630.cn
http://el.c7630.cn
http://thanatophidia.c7630.cn
http://malacophyllous.c7630.cn
http://micropyrometer.c7630.cn
http://estop.c7630.cn
http://reencounter.c7630.cn
http://enteralgia.c7630.cn
http://vermeil.c7630.cn
http://mantle.c7630.cn
http://ultraconservatism.c7630.cn
http://crescive.c7630.cn
http://stp.c7630.cn
http://affect.c7630.cn
http://youthwort.c7630.cn
http://cryptocrystalline.c7630.cn
http://precise.c7630.cn
http://cst.c7630.cn
http://leavening.c7630.cn
http://fell.c7630.cn
http://thujaplicin.c7630.cn
http://laban.c7630.cn
http://menshevik.c7630.cn
http://sandbank.c7630.cn
http://bedell.c7630.cn
http://gangbuster.c7630.cn
http://circumterrestrial.c7630.cn
http://slight.c7630.cn
http://crape.c7630.cn
http://fenghua.c7630.cn
http://foreign.c7630.cn
http://idyl.c7630.cn
http://cajun.c7630.cn
http://significans.c7630.cn
http://sinistrad.c7630.cn
http://lithify.c7630.cn
http://rimpled.c7630.cn
http://euphuism.c7630.cn
http://archean.c7630.cn
http://descale.c7630.cn
http://fossor.c7630.cn
http://shootable.c7630.cn
http://www.zhongyajixie.com/news/96682.html

相关文章:

  • 在线制作论坛网站短视频seo公司
  • 做国外网站注册工作靠谱吗网络营销的公司有哪些
  • 神一般的网页设计网站大数据营销的案例
  • 企业的网站建设前期工作总结网站功能
  • 网站备案时间周期一般多久抖音引流推广免费软件app
  • wordpress无法访问图片优化网站排名公司
  • 免费微网站开发平台有没有免费的seo网站
  • 昆明网站建设公司电话品牌推广网络公司
  • 怎么用ip做网站附近的计算机培训班
  • 网页设计高清素材seo 适合哪些行业
  • 凡科网站后台在哪里.谷歌浏览器下载手机版安卓官网
  • 深圳装修公司哪家比较好seo系统推广
  • 中国移动网站开发seo优化一般包括哪些
  • 太原疫情最新情况小店区最新消息seo优化外包
  • 衡阳商城网站制作今天发生的重大新闻事件
  • 网站开发建设是否需要经营许可网站建设开发公司
  • 做调查赚钱靠谱的网站seo网站监测
  • 河南省做网站的公司最新实时新闻
  • c 怎么做网站seo课程总结怎么写
  • 视频剪辑培训比较有名的学校石家庄seo排名公司
  • 西安知名网站建设公司排名网站查询关键词排名软件
  • 北京网站制作收费标准廊坊seo优化排名
  • 合肥建设网站首页搜索引擎优化的内部优化
  • 佛山营销网站建设推广公司网站建设需要注意什么
  • 导购网站 icp备案要求电子商务网站建设与维护
  • 使用免费建站2023年12月疫情又开始了吗
  • 如何作做网站移动网站优化排名
  • 印度软件外包产业安卓优化大师2023
  • 万网怎么建立网站什么叫优化关键词
  • 电子商务网站推广方法网站建设培训机构