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

el-ellipsis

v0.0.2

Published

![bar.gif](./src/assets/bar.gif) ## [demo](https://zhoufanglu.github.io/vue3-router-tabs-gitpage/#/home) ## 使用 ### 1、安装 ```npm i vue3-router-tabs -D``` ### 2、使用 ```vue <template> <RouterTabs :tabs="tabs" :route="route" @handleTabClick

Downloads

4

Readme

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

bar.gif

demo

使用

1、安装

npm i vue3-router-tabs -D

2、使用

<template>
  <RouterTabs 
      :tabs="tabs"
      :route="route"
      @handleTabClick="handleTabClick"
      @handleDeleteAllTab="handleDeleteAllTab"
  ></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, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()

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

// 点击tab事件,一般直接跳转路由
const handleTabClick = (tab: TabType) => {
  console.log(20, tab)
  router.push(tab.path)
}
// 右侧关闭事件
const handleDeleteAllTab = (type: 'all' | 'other') => {
  if (type === 'all') {
    tabs.value = []
  } else if (type === 'other') {
    const curPageTab = tabs.value.find((tab: TabType) => tab.path === route.path)
    tabs.value = curPageTab ? [curPageTab] : []
  }
}
</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/ :::