heikaimu / vue3-waterfall-plugin

vue3 瀑布流插件,支持 PC 和移动端,支持 animate 的所有动画效果,支持图片懒加载
https://vue3-waterfall.netlify.app/
390 stars 29 forks source link

chore: load-props中添加ratioCalculator字段,便于手动控制瀑布流图片比例 #53

Closed ec50n9 closed 9 months ago

ec50n9 commented 9 months ago

让用户可以控制瀑布流中图片的比例。

例如:限制图片只能为3:4或者4:3

<Waterfall
    :list="dataList"
    :breakpoints="{ 1200: { rowPerView: 2 } }"
    :load-props="{
      ratioCalculator: (width: number, height: number) => {
        let ratio = 1;
        if (width > height) ratio = 3 / 4;
        else if (width < height) ratio = 4 / 3;
        return ratio;
      },
    }"
  >
    ...
</Waterfall>
netlify[bot] commented 9 months ago

Deploy Preview for vue3-waterfall-new failed.

Name Link
Latest commit fdda2d10429eaa54e3cc6dad93791728132f589c
Latest deploy log https://app.netlify.com/sites/vue3-waterfall-new/deploys/65729cb2a7ad180008e095aa
heikaimu commented 9 months ago

可以的 :)