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

ly-tab

v3.0.2

Published

A better mobile touch-swappable reusable component for vue2.*

Downloads

263

Readme

3.x版本(非Vue3)

3.x版本将和目前的2.x版本存在使用方法及API上的不兼容,使用者如需升级,请参照3.x版本。强烈建议使用3.x版本,2.x版本将不再进行更新维护。

基本效果展示

v3 0 0

安装

yarn add ly-tab
# or
npm i ly-tab

使用

全局注册

import LyTab from 'ly-tab';

Vue.use(LyTab);

局部注册

import { LyTabs, LyTabBar, LyTabItem } from 'ly-tab';

export default {
  components: {
    LyTabs,
    LyTabBar,
    LyTabItem
  }
  // ...
}

LyTabs

简单示例

<ly-tabs v-model="value">
  <ly-tab-item name="1" title="选项卡1" />
  <ly-tab-item name="2" title="选项卡2" />
</ly-tabs>
export default {
  data() {
    return  {
      value: '1'
    }
  }
}

属性

| 属性 | 说明 | 类型 | 默认值 | | ---- | -----|---|----| | value | 当前激活的 tab 的 name 属性值 | string \| number | '' | | lineWidth | 当前激活 tab 下划线的宽度,单位 px | number | 30 | | lineHeight | 当前激活 tab 下划线的高度,单位 px | number | 3 | | activeColor | 激活状态下 tab 文案及下划线的颜色 | string | #1677ff | | additionalX | 近似等于超出边界时最大可拖动距离,单位 px | number | 50 | | reBoundExponent | 惯性回弹指数,值越大,惯性回弹距离越长 | number | 10 | | inertialDuration | 惯性滑动过程的持续时间,值越小,感知上阻力越大,可近似认为惯性滑动过程速度减为零所需的时间(ms) | number | 1000 | | reBoundingDuration | 回弹过程动画duration,单位 ms | number | 1000 |

事件

| 事件名 | 说明 | 回调参数 | | ----- | ---- | ----- | | change | 切换激活 tab 项的回调 | name: string \| number |

插槽

| 名称 | 说明 | | --- | ---- | | default | 默认插槽,放置 LyTabItem 组件 |

LyTabItem

属性

| 属性 | 说明 | 类型 | 默认值 | | ---- | -----|---|----| | title | 选项卡显示文字 | string | - | | name | 选项卡标识符 | string \| number | 选项卡索引 | | badge | 右上角徽标内容 | string \| number | - |

方法

| 方法名 | 说明 | 参数 | 返回值 | | ----- | ---- | ---- | ---- | | resize | 外层元素大小或组件布局、尺寸变化时,可以调用此方法来进行重绘 | - | - |

插槽

| 名称 | 说明 | | --- | ---- | | default | 选项卡文字内容插槽,优先级高于传入的 title 属性 | | icon | 选项卡图标 |

LyTabBar

简单示例

<ly-tab-bar v-model="value">
  <ly-tab-item name="1" title="选项卡1" />
  <ly-tab-item name="2" title="选项卡2" />
</ly-tab-bar>
export default {
  data() {
    return  {
      value: '1'
    }
  }
}

属性

| 属性 | 说明 | 类型 | 默认值 | | ---- | -----|---|----| | value | 当前激活的 tab 的 name 属性值 | string \| number | '' | | activeColor | 激活状态下 tab 文案及icon的颜色 | string | #1677ff |

事件

| 事件名 | 说明 | 回调参数 | | ----- | ---- | ----- | | change | 切换激活 tab 项的回调 | name: string \| number |

插槽

| 名称 | 说明 | | --- | ---- | | default | 默认插槽,放置 LyTabItem 组件 |

Vue3版本

Vue3版本正在路上,即将到来,敬请期待。