0.1.20 • Published 2 years ago
xuanchengxmcachetabs v0.1.20
xuanchengxmcachetabs
Project setup
yarn install xuanchengxmcachetabs
How to use
正式环境 vue 库需要使用 https://img-bulky.xunmengvip.com/cdn/js/img-bulky.xunmengvip.com_cdn_js_vue.global_2.min.js
import "xuanchengxmcachetabs/dist/cacheTabs.css";
const cacheFn = () => {
return remf.value;
};
<div style="margin-left:10px">
<Cachetab
key={this.route.path}
cacheFn={async () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(this.cacheFn());
}, 1);
});
}}
/>
</div>
在使用 KeepAlive 的地方需要使用以下格式,特别是 ref
<a-layout-content class="content">
<router-view
v-slots={{
default: ({ Component, route }) => {
return (
<KeepAlive ref={"remf"}>
<Component
key={this.route.path}
fullPath={this.route.fullPath}
name={route.meta.cn}
/>
</KeepAlive>
);
},
}}
></router-view>
</a-layout-content>