Socket
Book a DemoInstallSign in
Socket

ant-mini-dice-roller

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ant-mini-dice-roller

支付宝小程序摇骰子

1.0.3
latest
npmnpm
Version published
Weekly downloads
4
Maintainers
3
Weekly downloads
 
Created
Source

摇骰子 小程序组件

Install

tnpm

yarn add ant-mini-dice-roller

Usage

json

{
  "usingComponents": {
    "diceroller": "ant-mini-dice-roller/es/component/index"
  }
}

js

Page({
  data: {
    awardImg: '',
    awardName: '',
    tipText: '',
  },
  onStart() {
    toast('开始摇')
    this.setData({
      tipText: '正在抽奖...'
    });
    setTimeout(() => {
      this.setData({
        awardImg: 'https://gw.alicdn.com/tfs/TB1JsqGbHPpK1RjSZFFXXa5PpXa-289-298.png',
        awardName: '1等奖'
      })
    }, 2000);
  },
  onFinish() {
    toast('摇完啦')
    this.setData({
      tipText: `抽奖结果:${this.data.awardName}`
    });
  }
});

xaml

<view class="container">
  <diceroller
    clickMode="true"
    awardImg="{{awardImg}}"
    onStart="onStart"
    onFinish="onFinish"
  >
    <view slot="button">外部组件摇一摇按钮</view>
  </diceroller>
  <view class='tip-text'>{{tipText}}</view>
</view>

API

属性类型默认值含义
widthNumber318组件宽度(rpx)
heightNumber300组件高度(rpx)
backgroundString#FFF背景色
rollTimeNumber3000摇骰子时间(毫秒)
rollImgString查看摇奖时逐帧图片
initImgString查看初始化骰子图片
onStartFunc-开始回调
onFinishFunc-结束回调

Keywords

支付宝

FAQs

Package last updated on 31 Oct 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.