Comments (8)
我因为之前不小心把虚拟列表父容器的高度改成100%,以致于虚拟列表失效了,然后使用keep-alive组件的出现了问题,
后来发现并改成100vh之后就不会了。
from vue-virtual-waterfall.
我没有重现出来这种情况,你有例子的源码吗
from vue-virtual-waterfall.
可以贴一下您的例子代码吗?我看看是哪里不同
from vue-virtual-waterfall.
App.vue
的代码
<router-view v-slot="{ Component, route }">
<keep-alive>
<component :is="Component" :key="route.name" />
</keep-alive>
</router-view>
路由就两个页面一个是Example.vue
,加了一个按钮跳转到Other.vue
的页面,然后Other.vue
有个按钮跳转到Example.vue
from vue-virtual-waterfall.
我使用了 <keep-alive include="waterfall"></keep-alive>
才出现问题,请问要怎么指定单独一个路由保持状态?因为其他页面我不需要保持,但是不指定路由的话,其他页面也保持了
from vue-virtual-waterfall.
我的代码确实是错误的,使用<keep-alive include="waterfall"></keep-alive>
报错了,请问要怎么指定单独一个路由保持状态?
from vue-virtual-waterfall.
我看了一下官方的定义:
interface KeepAliveProps {
/**
* 如果指定,则只有与 `include` 名称
* 匹配的组件才会被缓存。
*/
include?: MatchPattern
/**
* 任何名称与 `exclude`
* 匹配的组件都不会被缓存。
*/
exclude?: MatchPattern
/**
* 最多可以缓存多少组件实例。
*/
max?: number | string
}
只要include指定组件的名字就好了,比如我的Example.vue
的默认名字就是Example
,然后向下面一样指定就好了
<router-view v-slot="{ Component, route }">
<keep-alive include="Example">
<component :is="Component" :key="route.name" />
</keep-alive>
</router-view>
from vue-virtual-waterfall.
感谢大佬耐心教导,谢谢!祝您生活愉快!
from vue-virtual-waterfall.
Related Issues (15)
- 1.1.0版本的思考 HOT 8
- 计算文本内容高度对于换行文本计算不是很友好 HOT 2
- itemWidth和itemMinWidth之间语义上有冲突? HOT 5
- Kind notice HOT 2
- 能否增加一个属性,设置两边gap为0? HOT 1
- 局部使用该虚拟列表时,由于获取参与计算的top是基于视口的,列表元素会在全局滚动时异常响应修改,我简单修改 基于父元素的scrollTop去做运算,测不出问题,不知道楼主是不是有其他考虑? HOT 1
- 有vue2的版本嘛 HOT 2
- 如何在滚动到页面底部时才加载下一页
- npm 包能否移除@arco-design/web-vue 和 mockjs HOT 2
- 有时间是否可以研究下支持一下ssr,nuxt这种框架 HOT 7
- 下个阶段的改进 HOT 8
- loadMoreData 一直再触发可能是什么原因呢? HOT 5
- 是不支持绑定滚动父元素吗,比如我想把滚动绑在window上,整个页面就全局一个滚动(列表上面要banner) HOT 8
- 虚拟列表不生效 HOT 1
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.