npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-router-tabs

v0.0.17

Published

![bar.gif](..%2F..%2F..%2Fgif-licecap%2Fbar.gif)

Downloads

15

Readme

添加tab的时候自动会定位到视图界面

bar.gif

使用

1、安装

npm i vue3-router-tabs -D

2、使用

<template>
  <RouterTabs 
      :tabs="tabs"
      :route="route"
  ></RouterTabs>
</template>
<script setup lang="ts">
import 'vue3-router-tabs/lib/style.css' // 引入样式
import { RouterTabs } from 'vue3-router-tabs' // 引入组件
import type { TabType } from 'vue3-router-tabs/lib/components/router-tabs/types' // 引入类型 js可以不引入

import { useRoute } from 'vue-router'
const route = useRoute()

const tabs = ref<TabType[]>([
  { name: '表格', path: '/table', activeMenu: 'table' },
  { name: '标题', path: '/title', activeMenu: 'title' },
  { name: '卡片', path: '/card', activeMenu: 'card' }
])
</script>

属性 & 事件

| 属性 | 说明 | 类型 | 是否必填 | |--------------------|--------------------------------------------------|------------------------|------| | tabs | 支持双向绑定v-model | TabType[] | 是 | | route | 路由对象, 用来绑定选中和跳转 | Route | 否 | | handleTabClick | tab点击的回调 | function(tab: TabType) | 否 | | handleDeleteAllTab | 关闭所有页面的回调 type的值为:all(关闭所有), other(关闭其它) | function(type:string) | 否 |

TabType类型

interface TabType {
  name: string // 菜单名称
  activeMenu?: string // 菜单选中绑定的值
  path: string //路由跳转的地址
  meta?: any // 自定义参数。。类似router的meta
}

注意点

::: warning 1、绑定的时候最好传入route对象, 因为选中是根据route对象的path来判断的, 或者根据route的meta内的activeMenu来判断选中的。
2、默认返回首页的path/ :::