Polyv Help Center

Help Center

Lottery

Updated: 2021-12-22 10:45:54

Import Component

import Lottery from '@polyv/interactions-launch-sdk-ui-default/lib/Lottery';

Code Example

<template>
  <!-- 建议弹窗宽度为 560px,弹窗内容高度建议自适应,最高height: 500px -->
  <el-dialog
    v-if="lotteryCore"
    :custom-class="'c-interactions-dialog c-interactions-dialog__h350'"
    width="560px"
    title="签到"
    :visible.sync="lotteryVisible"
    :close-on-click-modal="false"
  >
    <Lottery
      :lang="lang"
      :core="lotteryCore"
      :live-status='liveStatus'
      :is-subsidiary-room="false"
    />
  </el-dialog>
</template>

<script>
import * as InteractionsLaunchSDK from '@polyv/interactions-launch-sdk';
import Lottery from '@polyv/interactions-launch-sdk-ui-default/lib/Lottery';
// 弹窗组件可以选择其他 UI 库组件或自行开发,这里没有限制。
import { Dialog } from 'element-ui';

export default {
  components: {
    ElDialog: Dialog,
    Lottery,
  },
  data() {
    return {
      lotteryCore: null,
      liveStatus: true,
      lotteryVisible: false
    };
  },
  mounted() {
    // TODO: 关于初始化 InteractionsLaunchSDK 的其他设置
    this.lotteryCore = new InteractionsLaunchSDK.Lottery();
  }
};
</script>

Attributes

Attribute Type Default Description
core object Lottery SDK instance
lang string 'zh_CN' Language pack type. Possible values:
'zh_CN' Chinese
'en' English
liveStatus number false Live streaming status. Lottery functionality is only available after the live stream starts.
isSubsidiaryRoom boolean false Whether multi-room mode is enabled. When true, preset functionality is disabled.
maxWinnersDigit number 3 Maximum number of digits for the number of winners
visible boolean true Whether to display the lottery
联系客服,在线咨询