Comments (8)
嗯,好的,这个好,之前加个死的文字高度,只有一行文本的时候,空白区域太大。
只有文字的,我晚点试试。
我准备把有的内容,都关联到一个表里面,有图文的,有文字的。一起显示。
https://itrumors.com/buyers/xiaomi 现在部署了。 我这个也没有办法开源,好多内容没有弄上面来,等哪天完善了,再看要不要开源吧,现在设置为私有了。
不过还有很多待优化的点,使用起来,感觉哪里怪怪的。
内容还在加。现在用的 cf 有点卡。省掉了备案。
from vue-virtual-waterfall.
参考
from vue-virtual-waterfall.
已解决:
// 计算真实高度,这里只计算除了图片的高度
function getRealHeight(item: ItemOption, realWidth: number) {
const dom = document.createElement('div')
render(
h(Card, {
item: item,
width: realWidth + 'px',
noImage: true
}),
dom
)
document.body.appendChild(dom)
// 获取高度
const height: number = dom.clientHeight
// 移除新容器
document.body.removeChild(dom)
// 返回高度
return height
}
from vue-virtual-waterfall.
现在支持,没有图片,纯文字的版本吗?图片和文字混合的
from vue-virtual-waterfall.
现在支持,没有图片,纯文字的版本吗?图片和文字混合的
支持了,可以看例子,我通过创建一个临时dom去计算文本的高度,再把dom删除,文本高度加上图片高度就可以了
当然也可以连同图文一同计算,但如果图片太大,可能会耗时太久,我这里的数据是已知图片的尺寸,省去了图片的渲染,单独计算出文本渲染后的高度即可
from vue-virtual-waterfall.
刚才改了下,发现
render(h(WaterfallText, { data: item }), dom)
这个方法不支持NuxtImg,找了半天原因,最终算是调好了。新建了一个 WaterfallText 没有图片,只有title的组件,用来给render方法调用,哈哈
顺便梳理了一下代码。用了你的方式 useWaterfall
from vue-virtual-waterfall.
@dxhuii 原生的img不行吗?
from vue-virtual-waterfall.
@dxhuii 原生的img不行吗?
原生的应该没有问题。
from vue-virtual-waterfall.
Related Issues (15)
- 如何在滚动到页面底部时才加载下一页
- npm 包能否移除@arco-design/web-vue 和 mockjs HOT 2
- 有时间是否可以研究下支持一下ssr,nuxt这种框架 HOT 7
- loadMoreData 一直再触发可能是什么原因呢? HOT 5
- 是不支持绑定滚动父元素吗,比如我想把滚动绑在window上,整个页面就全局一个滚动(列表上面要banner) HOT 8
- 虚拟列表不生效 HOT 1
- 1.1.0版本的思考 HOT 8
- 使用keep-alive的时候出现bug HOT 8
- 计算文本内容高度对于换行文本计算不是很友好 HOT 2
- itemWidth和itemMinWidth之间语义上有冲突? HOT 5
- Kind notice HOT 2
- 能否增加一个属性,设置两边gap为0? HOT 1
- 局部使用该虚拟列表时,由于获取参与计算的top是基于视口的,列表元素会在全局滚动时异常响应修改,我简单修改 基于父元素的scrollTop去做运算,测不出问题,不知道楼主是不是有其他考虑? HOT 1
- 有vue2的版本嘛 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-virtual-waterfall.