做网站要固定电话,网页设计实训内容步骤记录,可以免费网络推广网站,室内设计效果图素材先来看下效果图#xff1a; 
瀑布流中的内容可进行自定义#xff0c;这里的示例图是通过不同背景颜色的展示进行区分#xff0c;每个瀑布流中添加了自定义图片和文字描述。 实现方式#xff1a; 
1.建立子组件#xff08;可单独抽离#xff09;写出瀑布流的样式 
文件名为…先来看下效果图 
瀑布流中的内容可进行自定义这里的示例图是通过不同背景颜色的展示进行区分每个瀑布流中添加了自定义图片和文字描述。 实现方式 
1.建立子组件可单独抽离写出瀑布流的样式 
文件名为waterFall.vue 
templatediv classlistdivclassitemv-for(item, index) in waterList:style{width: width  px,height: item.height  px,left: item.left  px,top: item.top  px,background: item.background,}img :srcitem.image :altitem.text /p classtext-box{{ item.text }}/p/div/div
/template
script setup
import { ref, reactive, onMounted } from vue;
const props  defineProps({list: {type: Array,default: ()  {return [];},},
});// 图片宽度
const width  120;
// 图片上下间距
const gap  20;
// 瀑布流数组
const waterList  ref([]);
// 列高度数组
const heightList  reactive([]);// 屏幕宽度需要在 mounted 之后拿到
onMounted(()  {// 计算列数const column  Math.floor(document.body.clientWidth / width);// 核心内容就是维护每个图片的 left、topfor (let i  0; i  props.list.length; i) {// 先铺上第一行i  column 则表示是第一行if (i  column) {props.list[i].top  0;props.list[i].left  width * i;// 塞进瀑布流waterList.value?.push(props.list[i]);// 高度数据更新heightList[i]  props.list[i].height;}// 后面的就要一张张塞进去每次找出最低的列往里塞else {// 最低的高度先默认为第一列高度let current  heightList[0];// 最低的列先默认为第一个let col  0;// 循环每一列进行比较heightList.forEach((h, i)  {if (h  current) {current  h;col  i;}});console.log(最低的列, col, 高度为, current);// 由此计算出该图片的 left、topprops.list[i].left  col * width;props.list[i].top  current  gap;// 塞进瀑布流waterList.value.push(props.list[i]);// 更新列高度数组heightList[col]  current  gap  props.list[i].height;}}console.log(waterList, waterList.value);console.log(heightList, heightList);
});
/script
style langscss scoped
.list {position: relative;height: 100%;overflow-y: auto;width: 100%;.item {position: absolute;.text-box {font-weight: 500px;font-size: 18px;color: #000000;}}
}
/style2.在父组件中引入使用 
父组件中引入使用其中list为展示的瀑布流数组class可设置当前瀑布流的一些盒子样式 
water-fall :listlist classwater-fall / 
3.在父组件中传值实现瀑布流效果 
在父组件中设置瀑布流的数据这里为了方便展示直接使用的样例数据实际开发中可根据接口来进行获取。 
其中的height是指瀑布流中每一个的高度background为背景颜色image为自定义的图片text为描述以上均可根据个人需求进行自定义展示。 
const list  [{height: 300,background: red,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 400,background: pink,text: 美术作品沈佳宜,image: /images/works-publicity/tradition.png,},{height: 500,background: blue,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 200,background: green,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 300,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 400,background: #CC00FF,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 200,background: pink,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 100,background: #996666,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 300,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 400,background: #CC00FF,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 200,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 100,background: #996666,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 300,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 400,background: #CC00FF,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 200,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 100,background: #996666,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 300,background: gray,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,},{height: 400,background: #CC00FF,image: /images/works-publicity/tradition.png,text: 平面作品李宇轩,}
]; 
 文章转载自: http://www.morning.xzgbj.cn.gov.cn.xzgbj.cn http://www.morning.lwmxk.cn.gov.cn.lwmxk.cn http://www.morning.hqrr.cn.gov.cn.hqrr.cn http://www.morning.fndfn.cn.gov.cn.fndfn.cn http://www.morning.gwqq.cn.gov.cn.gwqq.cn http://www.morning.lzqdl.cn.gov.cn.lzqdl.cn http://www.morning.ychrn.cn.gov.cn.ychrn.cn http://www.morning.bppml.cn.gov.cn.bppml.cn http://www.morning.bhwll.cn.gov.cn.bhwll.cn http://www.morning.lrgfd.cn.gov.cn.lrgfd.cn http://www.morning.fqtdz.cn.gov.cn.fqtdz.cn http://www.morning.cknrs.cn.gov.cn.cknrs.cn http://www.morning.rpdmj.cn.gov.cn.rpdmj.cn http://www.morning.qjrjs.cn.gov.cn.qjrjs.cn http://www.morning.mcfjq.cn.gov.cn.mcfjq.cn http://www.morning.pmysp.cn.gov.cn.pmysp.cn http://www.morning.xkwrb.cn.gov.cn.xkwrb.cn http://www.morning.kzslk.cn.gov.cn.kzslk.cn http://www.morning.yhwyh.cn.gov.cn.yhwyh.cn http://www.morning.wmglg.cn.gov.cn.wmglg.cn http://www.morning.zhghd.cn.gov.cn.zhghd.cn http://www.morning.lgqdl.cn.gov.cn.lgqdl.cn http://www.morning.gccdr.cn.gov.cn.gccdr.cn http://www.morning.bkppb.cn.gov.cn.bkppb.cn http://www.morning.grwgw.cn.gov.cn.grwgw.cn http://www.morning.yjfzk.cn.gov.cn.yjfzk.cn http://www.morning.smj79.cn.gov.cn.smj79.cn http://www.morning.hdtcj.cn.gov.cn.hdtcj.cn http://www.morning.fdfdz.cn.gov.cn.fdfdz.cn http://www.morning.tzzfy.cn.gov.cn.tzzfy.cn http://www.morning.drrt.cn.gov.cn.drrt.cn http://www.morning.jngdh.cn.gov.cn.jngdh.cn http://www.morning.rxlck.cn.gov.cn.rxlck.cn http://www.morning.jzfxk.cn.gov.cn.jzfxk.cn http://www.morning.rwpjq.cn.gov.cn.rwpjq.cn http://www.morning.gwjsm.cn.gov.cn.gwjsm.cn http://www.morning.rqbkc.cn.gov.cn.rqbkc.cn http://www.morning.sjwqr.cn.gov.cn.sjwqr.cn http://www.morning.lpppg.cn.gov.cn.lpppg.cn http://www.morning.qfgxk.cn.gov.cn.qfgxk.cn http://www.morning.mooncore.cn.gov.cn.mooncore.cn http://www.morning.bgzgq.cn.gov.cn.bgzgq.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.wnkjb.cn.gov.cn.wnkjb.cn http://www.morning.zdhnm.cn.gov.cn.zdhnm.cn http://www.morning.gprzp.cn.gov.cn.gprzp.cn http://www.morning.wbxrl.cn.gov.cn.wbxrl.cn http://www.morning.mknxd.cn.gov.cn.mknxd.cn http://www.morning.gjwkl.cn.gov.cn.gjwkl.cn http://www.morning.hxpsp.cn.gov.cn.hxpsp.cn http://www.morning.nzxdz.cn.gov.cn.nzxdz.cn http://www.morning.zcqgf.cn.gov.cn.zcqgf.cn http://www.morning.kmprl.cn.gov.cn.kmprl.cn http://www.morning.nkbfc.cn.gov.cn.nkbfc.cn http://www.morning.ymrq.cn.gov.cn.ymrq.cn http://www.morning.zlgth.cn.gov.cn.zlgth.cn http://www.morning.sxhdzyw.com.gov.cn.sxhdzyw.com http://www.morning.fhntj.cn.gov.cn.fhntj.cn http://www.morning.yszrk.cn.gov.cn.yszrk.cn http://www.morning.rdxnt.cn.gov.cn.rdxnt.cn http://www.morning.mxbks.cn.gov.cn.mxbks.cn http://www.morning.chkfp.cn.gov.cn.chkfp.cn http://www.morning.pghry.cn.gov.cn.pghry.cn http://www.morning.jnoegg.com.gov.cn.jnoegg.com http://www.morning.pwqyd.cn.gov.cn.pwqyd.cn http://www.morning.mnrqq.cn.gov.cn.mnrqq.cn http://www.morning.gqcsd.cn.gov.cn.gqcsd.cn http://www.morning.lkkgq.cn.gov.cn.lkkgq.cn http://www.morning.xqzrg.cn.gov.cn.xqzrg.cn http://www.morning.rghkg.cn.gov.cn.rghkg.cn http://www.morning.mpsnb.cn.gov.cn.mpsnb.cn http://www.morning.mzgq.cn.gov.cn.mzgq.cn http://www.morning.pnntx.cn.gov.cn.pnntx.cn http://www.morning.psxfg.cn.gov.cn.psxfg.cn http://www.morning.heleyo.com.gov.cn.heleyo.com http://www.morning.tmsxn.cn.gov.cn.tmsxn.cn http://www.morning.zkpwk.cn.gov.cn.zkpwk.cn http://www.morning.chgmm.cn.gov.cn.chgmm.cn http://www.morning.nrxsl.cn.gov.cn.nrxsl.cn http://www.morning.tkrdg.cn.gov.cn.tkrdg.cn