lighting-ui
Version:
A rich interaction, lightweight, high performance UI library based on Weex
87 lines (69 loc) • 2.57 kB
Markdown
# lc-lottery-rain
> Cat-Cat
### Rule
- Usually used in marketing campaigns, similar to cat-cat or groundhog.
- The element image and container style can be configured to match the current activity atmosphere.
## [Demo](https://h5.m.taobao.com/trip/lc-lottery-rain/index.html?_wx_tpl=https%3A%2F%2Fh5.m.taobao.com%2Ftrip%2Flc-lottery-rain%2Fdemo%2Findex.native-min.js)
<img src="https://gw.alipayobjects.com/zos/rmsportal/LhUMuYgbZmUSAOezSTEV.gif" width="240"/> <img src="https://img.alicdn.com/tfs/TB1MciTdwMPMeJjy1XbXXcwxVXa-200-200.png" width="160"/>
## Code Example
```vue
<template>
<lc-lottery-rain :config="config"
:pic-list="images"
ref="lc-lottery-rain"
:wrap-style="wrapStyle"
@LcLotteryRainCaught="LcLotteryRainCaught"></lc-lottery-rain>
</template>
<style scoped>
</style>
<script>
import { LcLotteryRain } from 'weex-ui';
export default {
components: { LcLotteryRain },
data: () => ({
images: [
'https://img.alicdn.com/tfs/TB1sZPlb5IRMeJjy0FbXXbnqXXa-241-206.png',
'https://img.alicdn.com/tfs/TB1eCbwb3MPMeJjy1XcXXXpppXa-241-206.png',
'https://img.alicdn.com/tfs/TB1rDTjb3MPMeJjy1XdXXasrXXa-241-206.png',
'https://img.alicdn.com/tfs/TB1Nw2sb3MPMeJjy1XbXXcwxVXa-241-206.png',
'https://img.alicdn.com/tfs/TB1hCbwb3MPMeJjy1XcXXXpppXa-241-206.png'
],
config: {
intervalTime: 450,
hideAniTime: 300,
showAniTime: 300,
showTime: 450,
randomTime: 300,
width: 241,
height: 206
},
wrapStyle: {
backgroundColor: 'rgba(133, 11, 11, .7)'
}
}),
methods: {
LcLotteryRainCaught (e) {
// console.log(e.rainId)
}
}
}
</script>
```
More details can be found in [here](https://github.com/alibaba/weex-ui/blob/master/example/lottery-rain/index.vue)
### API
| Prop | Type | Required | Default | Description |
|-------------|------------|--------|-----|-----|
| pic-list | `Array` |`Y`| `[]` | a group of cat pictures|
| config | `Object` |`N`| `{}` | [game config](https://github.com/alibaba/weex-ui/blob/master/packages/lc-lottery-rain/libs/config.js) |
| wrap-style | `Object` |`N`| `{}` | wrap style |
### Caught Event
```
@LcLotteryRainCaught="LcLotteryRainCaught"
// will return id
```
### Destroy Event
When users leave the game, We need destroy the game
```
//<lc-lottery-rain ref="lc-lottery-rain"></lc-lottery-rain>
this.$refs['lc-lottery-rain'].destroy();
```