Socket
Socket
Sign inDemoInstall

vue-multiview

Package Overview
Dependencies
21
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-multiview

Simple lib to create multi document interface with vue, can be used with vue-router


Version published
Maintainers
1
Created

Readme

Source

vue-mdi-interface

library to handle many vue components like tabs in browser

Compatible with vue-router

Online demo: https://mdi.fragster.ru/ Demo source code: https://github.com/FragsterAt/mdi-interface-demo

Installation

yarn add vue-mdi-interface
# or
npm install vue-mdi-interface

Usage

Create object with available 'views'

const views = {
  counter: {
    meta: { icon: 'calculate' }, // any meta info
    component: () => import('pages/CounterView.vue')
  },
  image: {
    title: 'Image view', // default title of view (if not specified - this is key of view)
    component: () => import('pages/ImageView.vue')
  },
  entity: () => import('pages/EntityView.vue') // if all controlled by view component, you can pass only import
}

Add plugin to vue app

import { createApp } from 'vue'
import { createMdiInterface } from 'vue-mdi-interface'

import App from './App.vue'

const app = createApp(App)

app.use(createMdiInterface, {views})

app.mount('#app')

Add component to show content of views

<mdi-view>
    <!-- default content, if current view is not specified-->
    <router-view /> <!-- for example it can be router-->
</mdi-view>

Add component to switch between views

Here is example with Quasar but you can use lib with any vue-based framework or even without framework at all

<template>
  <q-tabs v-model="currentView" align="left" inline-label>
    <q-tab :name="ZERO_VIEW_ID" icon="home" label="Router" />
    <q-tab :name="view.viewId" :icon="view.meta.icon" v-for="view in viewList" :key="view.viewId">{{
      view.title }} <q-btn round flat @click.stop="closeView(view.viewId)" icon="delete" dense></q-btn></q-tab>
  </q-tabs>
</template>

<script setup>
import { viewList, currentView, closeView, ZERO_VIEW_ID } from 'src/vue-mdi-interface'

</script>

Open view

Simple open view (or activate if it is opened)

Register callbacks

Change view properties

Close view

API

Keywords

FAQs

Last updated on 07 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc