0.0.21 • Published 3 years ago

@retailwe/ui-tab v0.0.21

Weekly downloads
15
License
-
Repository
-
Last release
3 years ago

tab 顶部导航

引入

全局引入,在 miniprogram 根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

// app.json 或 index.json
"usingComponents": {
  "wr-tab": "@retailwe/ui-tab/index"

}

代码演示

基础用法

通过tabList属性传入 tab 项 tab 项为对象, text 设置文本, key 设置对应 tab 标识; 通过在status属性来初始化选中项

<wr-tab
  status="{{status}}"
  bind:tabChange="tabChange"
  tabList="{{list}}"
  isScroll="{{true}}"
/>
Page({
  data: {
    status: 0,
    list: [
      {
        text: '全部',
        key: 0,
      },
      {
        text: '待付款',
        key: 1,
      },
      {
        text: '待取货',
        key: 2,
      },
      {
        text: '已完成',
        key: 3,
      },
    ],
  },

  tabChange(e) {
    this.setData({
      status: e.detail,
    });
  },
});

API

tab Props

参数说明类型默认值版本
tabListtab 数据array[]-
status选中项的索引number0-
isScroll配置 tab 是否支持横向滑动booleantrue-
color默认颜色string--
lineColor激活颜色string--
lineHeight激活底部线条高度number--
lineWidth激活底部线条宽度booleannumber-

tabList属性声明

interface TabList {
  [index: number]: {
    key: number | string; // 每个对象的唯一值,用于锁定当前选中的对象
    text: string; // tab文案
    dot?: boolean; // 是否显示红点角标,为true时info属性无效
    info?: number | string; // 角标内容
  };
}

tab Event

事件名说明参数
tabChange切换选项时触发当前选中选项的索引
0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7-beta.1

4 years ago