1.0.1 • Published 4 years ago

th-lucky-plate1 v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

th-lucky-plate

一个大转盘逻辑

Install

# install dependencies
npm install th-lucky-plate --save

Usage

import NameCustom from 'th-lucky-plate'

Vue.use(NameCustom)

Register

<wheel class="lucky" :list="list" :getPrize="getPrize" @getAward="getAward">
  <!-- 转盘 -->
  <div slot="plate" ref="plate"></div>
  <!-- 指针 -->
  <div slot="pointer"></div>
</wheel>

Api

list(Array): slot传入转盘的奖品列表

list: [{id: 1, img: ''}]

getPrize(Function): 接口获得的奖品id返回数据的方法

例: getPrize () {
      return { id: 2 }
    }

getAward(Function): 回传的奖品列表index值

例: getAward (index) {
      console.log(index)
    }

rotate(Number): 旋转角度 默认7200

time(Number): 时间 默认 5000
1.0.1

4 years ago