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

@ctmobile/ui-tab-sd

v1.0.1

Published

支持移动端的UI组件-Tab

Downloads

6

Readme

Tab

基本布局


<template id="tabtemplate">
  <div class="ct-tab">A
    <!-- 指示器 -->
    <div class="ct-tab-indicator swiper-container">
      <div class="swiper-wrapper">
        <div class="swiper-slide">
          <span class="ct-tab-indicator-item-label">...</span>
        </div>
        ...
      </div>

    </div>

    <!-- 卡片 -->
    <div class="ct-tab-content swiper-container">
      <div class="swiper-wrapper">
        <div class="ct-tab-content-item swiper-slide">...</div>
      </div>
    </div>
  </div>
</template>

初始化


 import Tab, { TabItem } from '@ctmobile/ui-tab';
 import '@ctmobile/ui-tab/tab.less';

 class MyTabItem extends TabItem {
   constructor(index) {
     super(index);
   }

   create() {
     console.log(this.index, 'create');
   }

   show() {
     console.log(this.index, 'show');
   }

   beforeHide() {
     console.log(this.index, 'beforeHide');
   }
 }

 const el = document.getElementById('tab');
 const tel = document.getElementById('tabtemplate');

 const myTab = new Tab(el, tel, {
   indicator: {
     position: 'left',
     type: 'average',
     theme: 'oval',
     slidesPerView: 3,
     arrow: false,
   },
   content: {
     mode: 'mulit',
     isSwiper: true,
     direction: 'horizontal',
     tabInstances: [MyTabItem],
   },
   initialSlide: 0,
 });

| 名称 | 说明 | | --- | --- | | {HtmlElement} - el | 父容器元素 | | {HtmlElement} - tel | 模板元素 | | {object} - config |

  • 指示器配置 {object} - config position {String} - 指示器位置 [top | bottom | left | right]type {String} - 指示器的类型 [average(平均) | dynamic(动态)]slidesPerView {Number} - 指示器一个卡片数量 --只有type是dynamic时才生效theme {String} - 指示器的主题 --只有type是average时才生效 [radius(圆角) | oval(椭圆) | normal(正常)]
  • 卡片配置 {object} - config mode {String} - 页卡的模式 [single | mulit]isSwiper {Boolean} - 是否可以滑动 --只有mode为mulit时才起作用 [true | false]tabInstances {Array} - tab对应的处理 必须是TabItem类的对象 [Object]direction {String} - tab页卡的方向 [horizontal | vertical] | | {String} - initialSlide | 初始化的索引 |

例子

html

js

方法

slideTo( index, ) - 跳转到指定页面

  • index-string 索引

appendSlide( indicatorObj, contentObj, impls, ) - 追加指定的slide

  • indicatorObj-Object 指示器配置
  • contentObj-Object 卡片配置
  • impls-Function/Array 卡片实现类

prependSlide( indicatorObj, contentObj, impls, ) - 向前追加指定的slide

  • indicatorObj-Object 指示器配置
  • contentObj-Object 卡片配置
  • impls-Function/Array 卡片实现类

addSlide( index, indicatorObj, contentObj, impls, ) - 在指定位置追加指定的slide

  • index-number 索引
  • indicatorObj-Object 指示器配置
  • contentObj-Object 卡片配置
  • impls-Function/Array 卡片实现类

removeSlide( slideIndex, ) - 在指定索引处删除Slide

  • slideIndex-number 索引

getCount() - 获取卡片数量

事件

| 名称 | 说明 | | --- | --- | | create | 创建 | | beforeShow | 显示 | | beforeClose | 隐藏之前 |