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

vue-cus-tabs

v0.1.2

Published

customizable vue tab components

Downloads

9

Readme

Introduction

Vue-Cus-Tabs implements most of the common tab requirements, and you only need a simple configuration to render a tab on the page. Vue-Cus-Tabs has no dependencies other than Vue.

Vue-Cus-Tabs实现了大部分常见的tab需求,你只需要简单配置即可在页面上呈现一个tab。Vue-Cus-Tabs除了Vue以外没有任何依赖项。

demo:https://vue-cus-tabs-axel10.now.sh

Example

install:

npm i vue-cus-tabs -S

template:

    <CusTabWrap>
      <template v-slot:tabBar>
        <CusTabBar :style="{'height':'50px'}">
          <CusTabItem v-for="item in tabItems" :key="item.title">
            {{item.title}}
          </CusTabItem>
        </CusTabBar>
      </template>

      <template v-slot:tabContainer>
        <CusTabContainer>
          <CusTabContainerItem v-for="item in tabItems">
            <ul>
              <li v-for="data in item.data">
                {{data.title}}
              </li>
            </ul>
          </CusTabContainerItem>
        </CusTabContainer>
      </template>
    </CusTabWrap>

script:

  import Vue from 'vue'
  import 'vue-cus-tabs/style/index.css'
  import { installCusTabs } from 'vue-cus-tabs';
  Vue.use(installCusTabs);
  
  import { TabController } from 'vue-cus-tabs';
  import 'vue-cus-tabs/style/index.css'
 
  Vue.use(CusTabs);

  export default class Test extends Vue{
        public tabItems = [
          { title: '新闻', type: 'list', data: [{ img: '', title: 'list item title' }] },
          { title: '视频', type: 'block', data: [{ video: '', title: 'list item title' }] },
          { title: '视频1', type: 'block', data: [{ video: '', title: 'list item title' }] },
        ];
    public tabController?: TabController;
    public mounted() {
      this.tabController = new TabController({ data: this.tabItems, tabScroll: true, initIndex: 1 });
    }
  }

Configuration

Constructor:

| name | type | detail | required | default value | | --- | --- | --- | --- | --- | | data | array | 用于渲染的数据 | true | | | selector | string | 用于选择CusTabWrap组件 | false | #__cus-tabs | | activeColor | string | 指定已激活tab的文字颜色 | false | | | inactiveColor | string | 指定未激活tab的文字颜色 | false | | | initIndex | number | 用于指定初始索引 | false | 0 | | rebound | boolean | 指定tab处于左右边缘时滑动是否回弹 | false | false | | tabScroll | boolean | 指定tab是否可滚动 | false | false | | duration | number | 点击tab | false | #__cus-tabs | | selector | string | 用于选择CusTabWrap组件 | false | #__cus-tabs | | scrollEndOffset | number | 触发onScrollEnd事件的偏移 | false | 0 | | indicatorOptions | object | 用于配置指示器的对象 | false | | | onScrollEnd | (index: number) => void | 容器内容滚动到底部时的回调 | false | | | onChange | (index: number, data: any) => void | 指定tab切换后的回调 | false | |

indicatorOptions:

| name | type | detail | required | default value | | --- | --- | --- | --- | --- | | backgroundColor | string | 指定指示器的颜色 | false | #409eff | | height | string | 指定指示器的颜色 | false | type | | width | string | 指定指示器的宽度,值可为'cover','content'或者百分比。如90%。为cover时宽度为整个tab项的宽度,为content时宽度为tab项内部内容的宽度。为百分比时宽度为内部内容宽度的百分比 | false | 2px |

instance method:
实例方法:

| name | params | detail | | --- | --- | --- | | push | tabItem:object | 添加tab。参数为结构与data数组内元素相同的数据对象 | | remove | i:number | 移除指定序号的tab | | changeTab | targetIndex: number, isAnimate?: boolean, time?: number | 切换到指定序号的tab。可以选择是否有动画以及动画时间。 |