A Vue plugin uses vue-router to realize a Stack type UI

vue-stacked-ui

Description

vue-stacked-ui provides "Stacked UI" at the top of vue-router(v4).

It is possible to realize a UI that allows users to drill down through data, sometimes seen in dashboards.

Following features,

  • Allows infinite number of pages to be stacked.
  • URL-first design. (URL representing stack state)
  • Browser history support.
  • Route params passed to page by vue-router.
  • Provides callback to block when "pop" Stack.

View Demo View Github

Requirement

  • Vue 3
  • vue-router 4

Install

npm install vue-stacked-ui

Usage

(Preparation) Load plugin in main.ts

import router from './router'
import { stackedUI } from 'vue-stacked-ui'
import 'vue-stacked-ui/dist/vue-stacked-ui.css'
// Then use it as Vue plugin.
app.use(stackedUI, {router: router});

TypeScript

(Preparation) Allow slug parameter in router/index.ts

    {
      path: '/about/:v1?/:v2?/:v3?/\/:slug(.*)?',  // add "/\/:slug(.*)?"
      props: true,
      meta: { stackable: true }  // Mark page can use as stack.
    }

TypeScript

(Use) Control stack

<StackPush to="/about">stack push component</StackPush>
<StackPop>stack push component</StackPop>

HTML

(Use) Programatically control stack

import { useStack } from "vue-stacked-ui"
const stack = useStack(); 
stack.push("/about/hoge")
stack.pop()

TypeScript

(Use) Register onBeforePop callback if you need.

props.currentStack?.onBeforePop(() => {
  return confirm("Realy close stack?")
});

TypeScript

Licence

MIT

Author

iridge-mu

Related Posts

Recent Posts

ഇടുക്കിയിലെ മലയോര മേഖലകളിൽ രാത്രിയാത്ര നിരോധിച്ചു. രാത്രി ഏഴു മുതൽ രാവിലെ ആറു വരെയാണ് നിരോധനം

ഏന്തയാർ ഈസ്റ്റിൽ പ്രളയത്തിൽ തകർന്ന പാലത്തിന് പകരം പുതിയ പാലം നിർമ്മിക്കുവാൻ താത്ക്കാലിക പാലം പൊളിച്ച് നീക്കി

Explore the Investment Opportunities: A Comprehensive Guide to Different Types of Mutual Funds

Title: Understanding Mutual Funds: A Beginner's Guide to Investing

തീവ്രമഴ മുന്നറിയിപ്പിന്റെ പശ്ചാതലത്തിൽ സംസ്ഥാനം ജാഗ്രതയിൽ

250,000 അപേക്ഷകൾ വർദ്ധിച്ചതിനാൽ ട്രാൻസ്‌പോർട്ട് കമ്മീഷണർ പരിശോധന പുനരാരംഭിക്കും

ഏലക്കയിൽ കീടനാശിനി സാന്നിധ്യം; ആറര ലക്ഷത്തിലധികം ടിൻ അരവണ നശിപ്പിക്കാൻ ടെൻഡർ ക്ഷണിച്ച് ദേവസ്വം ബോർഡ്‌

ഭീമൻ പാറക്കഷണങ്ങൾ അടർന്ന് ദേശീയ പാതയിലേക്ക് വീഴുന്നത് പതിവാകുന്നു. കുട്ടിക്കാനത്തിനും മുണ്ടക്കയത്തിനുമിടയിൽ നിലനിൽക്കുന്നത് വൻ അപകട ഭീഷണി

ചക്രവാതച്ചുഴി:അതിശക്തമായ മഴ വരുന്നു

പ്ലസ് വൺ പ്രവേശനം. അക്ഷയയിൽ തിക്കി തിരക്കേണ്ട, നെറ്റിവിറ്റി/ജാതി തെളിയിക്കാൻ പത്താംതരം സർട്ടിഫിക്കറ്റ് മതി