1.0.19 • Published 7 months ago

vue3-keep-alive-component v1.0.19

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

Vue 3 Keep Alive Component

A workaround solution for vue3 router&keep-alive components issue keep-alive component in nested route result in child route mounted twice

Installation

npm i vue3-keep-alive-component -S

Usage

Keep Router Alive

<template>
   <router-view v-slot="{ Component }">
      <KeepAliveComponent :component="Component" />
   </router-view>
</template>
<script lang="ts" setup>
   import { KeepAliveComponent } from 'vue3-keep-alive-component'
</script>
<style></style>

Use Activated Route

When using <KeepAliveComponent/> and useRoute() together, there will be problem. In this case, use useActivatedRoute() instead.

import { useActivatedRoute } from 'vue3-keep-alive-component'

const activatedRoute = useActivatedRoute() // a replacement api for official api useRoute()

Building

  • Clone this repo
  • Make sure you have node-js >=18.16
  • Install dependencies npm install
  • Run webpack dev server npm run build

License

MIT License

1.0.19

7 months ago

1.0.18

7 months ago

1.0.17

7 months ago

1.0.16

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

9 months ago

1.0.0

9 months ago