A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.npmjs.com/package/vue-page-stack below:

vue-page-stack - npm


  1. FIx the bug of refreshing the browser and then going back
  1. Fixed the page caching issue when using replace.
  1. Removed the stack-key parameter from the URL.
  2. Due to special handling of built-in components in Vue3.x, it is currently not possible to use it together with Transition.

This is the version of Vue3.0, Vue2.0 please click this link

English | 简体中文

A Vue3 SPA navigation manager,cache the UI in the SPA like a native application, rather than destroy it.

preview

demo code

The difference between VuePageStack and KeepAlive
pnpm install vue-page-stack
import { createApp } from 'vue';
import { VuePageStackPlugin } from 'vue-page-stack';

const app = createApp(App);

// router is necessary
app.use(VuePageStackPlugin, { router });
// App.vue
<template>
  <router-view v-slot="{ Component }">
    <vue-page-stack @back="onBack" @forward="onForward">
      <component :is="Component" :key="$route.fullPath"></component>
    </vue-page-stack>
  </router-view>
</template>

<script setup>
const onBack = () => {
  console.log('back');
};

const onForward = () => {
  console.log('forward');
};
</script>

use Vue.use to install vue-page-stack

import { VuePageStackPlugin } from 'vue-page-stack';

//...
app.use(VuePageStackPlugin, { router });

Options description:

Attribute Description Type Accepted Values Default router vue-router instance Object vue-router instance - name VuePageStack name String 'VuePageStack' 'VuePageStack'

If you want to make some animate entering or leaving, vue-page-stack offers stack-key-dir to judge forward or backward.

// App.vue
<vue-page-stack @back="onBack" @forward="onForward">
  <component :is="Component" :key="$route.fullPath"></component>
</vue-page-stack>

example

Details changes for each release are documented in the release notes.

Getting the current page instance refers to the keep-alive section of Vue.

The plug-in draws on both vue-navigation and vue-nav,Thank you very much for their inspiration.

Thanks goes to these wonderful people (emoji key):


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4