使用场景:tab 切换 居多
注意事项 :
1.在 Vue2 的时候 is 是通过组件名称切换的 在 Vue3 setup 是通过组件实例切换的
2.如果你把组件实例放到 Reactive Vue 会给你一个警告 runtime-core.esm-bundler.js:38 [Vue warn]: Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with
markRaw
or usingshallowRef
instead ofref
.Component that was made reactive:
这是因为 reactive 会进行 proxy 代理 而我们组件代理之后毫无用处 节省性能开销 推荐我们使用 shallowRef 或者 markRaw 跳过 proxy 代理
修改如下: