微信控件使用文档

飞道科技

count-down

小程序自定义组件

使用此组件需要依赖小程序基础库 2.2.1 以上版本,同时依赖开发者工具的 npm 构建。具体详情可查阅官方 npm 文档

1. 使用示例

使用示例

2. 使用方法

  1. 安装 小程序控件widgets-wxapp

     npm install @feidao-factory/widgets-wxapp
    
  2. 在需要使用 count-down 的页面 page.json 中添加 count-down 自定义组件配置

     {
         "usingComponents": {
             "count-down": "@feidao-factory/widgets-wxapp/fd-wx000002/index"
         }
     }
    
  3. WXML 文件中引用 count-down

<count-down timer='6000' atuo bind:fdwe-timestop='stop1' wid='001'></count-down>
<count-down timer='6000' bind:fdwe-timestop='stop2' wid='002'></count-down>

3. 属性

属性名 类型 默认值 是否必须 说明
timer Number   slide-view组件的宽度
wid String   控件标示
atuo     如果具有该属性,倒计时会自动开始

4.方法

refresh()

刷新倒计时控件

参数:

  1. timer 倒计时初始时间,单位为毫秒【number】

使用示例:

wxml

<count-down timer='6000' bind:fdwe-timestop='stop2' wid='w0001'></count-down>

ts

import select_component from '@feidao/web/atom/wx/app/api/xml/select-component';

const widget = select_component('#w0001');	// 获取控件实例
widget.refresh(8000);				// 调用控件方法

pause()

暂停倒计时

continue()

继续倒计时

stop()

停止倒计时

5.事件

fdwe-timestop

倒计时结束事件

可以通过 args[0].detail.wid获取控件的唯一标示