tsx-naive-admin icon indicating copy to clipboard operation
tsx-naive-admin copied to clipboard

KeepAlive问题

Open 17359898647 opened this issue 3 years ago • 3 comments

image 你的KeepAlive缓存是无作用的。这种写法有效。 但是我不清楚Component的类型先写个any,如果你知道的话麻烦告诉我一下 还有一个问题就是我还没有实现Transition和KeepAlive共同使用时的切换效果,希望你能一起看看

17359898647 avatar Oct 21 '22 08:10 17359898647

我找到了同时使用的写法 image 他在组件使用空标签<></>包裹根views组件时会报错,不清楚原因

17359898647 avatar Oct 21 '22 09:10 17359898647

Component 的类型是 VNode,文档有写。整体的参考

<RouterView>
        {{
          default: ({ Component }: { Component: VNode }) => (
            <Transition
              mode="out-in"
              name="fade"
            >
              <KeepAlive>
                <Suspense>
                  {{
                    default: () => h(Component),
                    fallback: () => '正在加载。。。'
                  }}
                </Suspense>
              </KeepAlive>
            </Transition>
          )
        }}
      </RouterView>

他在组件使用空标签<></>包裹根views组件时会报错 没看懂。 最近抽时间在重写(但也是比较忙,有点慢),KeepAlive 缓存那块需要组件 name, 我还没有完善

WalkAlone0325 avatar Oct 25 '22 07:10 WalkAlone0325

Suspense好像又有新的问题,快速切换路由时会报错。。

17359898647 avatar Oct 26 '22 07:10 17359898647