New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ly-tab

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ly-tab

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

latest
Source
npmnpm
Version
3.0.2
Version published
Maintainers
1
Created
Source

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 下划线的宽度,单位 pxnumber30
lineHeight当前激活 tab 下划线的高度,单位 pxnumber3
activeColor激活状态下 tab 文案及下划线的颜色string#1677ff
additionalX近似等于超出边界时最大可拖动距离,单位 pxnumber50
reBoundExponent惯性回弹指数,值越大,惯性回弹距离越长number10
inertialDuration惯性滑动过程的持续时间,值越小,感知上阻力越大,可近似认为惯性滑动过程速度减为零所需的时间(ms)number1000
reBoundingDuration回弹过程动画duration,单位 msnumber1000

事件

事件名说明回调参数
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版本正在路上,即将到来,敬请期待。

Keywords

Vue

FAQs

Package last updated on 30 Apr 2022

Did you know?

Socket

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