# @wecity/qiankun-cache

> qiankun缓存组建，实现类型vue中的keep-alive

Latest version **0.0.1** (published 2021-12-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install @wecity/qiankun-cache
pnpm add @wecity/qiankun-cache
yarn add @wecity/qiankun-cache
bun add @wecity/qiankun-cache
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-12-23 |
| First published | 2021-12-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | legendlu |
| Maintainers | legendlu, fenfeizeng, colinczhu, yangjiqiang, easonruan, yikazhu, daniel-dx, domy, delenzhang, vickiliang, derrickliu, xiaoyaojones, smileswlin, jillysong, allennzhang, sharryliao, pechelhuang, phspan |
| Keywords | qiankun |

## Links

- npm: https://www.npmjs.com/package/@wecity/qiankun-cache
- npm.io page: https://npm.io/package/@wecity/qiankun-cache

## Recent versions

- 0.0.1 (latest) — 2021-12-23

## README

# @wecity/qiankun-cache

```shell
npm i @wecity/qiankun-cache -S
```

## proxyMount
```javascript
import { proxyMount } from '@wecity/qiankun-cache'
export function mount(props) {
    router = Router.init(Vue, props)
    const instanceFn = () => {
        return new Vue({
          router,
          store,
          render: h => h(App)
        }).$mount(container ? container.querySelector('#app') : '#app')
      }
      const renderVNode = vnode => {
        return new Vue({
          router,
          store,
          render: () => vnode
        }).$mount(container ? container.querySelector('#app') : '#app')
      }
    
    instance = proxyMount({
      router,
      instanceFn,
      renderVNode
    })
}
```

| 字段名 | 类型 | 描述 |
| :---- | :--- | :--- |
| router | object | 路由实例 |
| instanceFn | function | 渲染函数 |
| renderVNode | function | 缓存渲染函数 |

## proxyUnmount

```javascript
import { proxyUnmount } from '@wecity/qiankun-cache'
export function unmount() {
  proxyUnmount({ instance })
  instance.$destroy()
  instance = null
  router = null
}
```

| 字段名 | 类型 | 描述 |
| :---- | :--- | :--- |
| instance | object | 实例 |


# 注意

1. 第二次进入闪屏问题： css、js打包在一起不要分别打包

---
_Source: https://npm.io/package/@wecity/qiankun-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
