跳到内容
SCRM DOC
创建于2025-03-20更新于 2025-03-22

02. Sweepstakes 抽奖组件

第一步: 引入

import { LuckyGrid, LuckyWheel, SlotMachin } from '/@/components/Common/Activity/Sweepstakes';
  • LuckyGrid 九宫格
  • LuckyWheel 大转盘
  • SlotMachin 老虎机
import { LuckyGrid, LuckyWheel, SlotMachin } from '/@/components/Common/Activity/Sweepstakes';


<LuckyWheel @register="wheelSweepModal" @success="handleSweep" />  
  
<LuckyGrid @register="registerSweepModal" @success="handleSweep" />  
  
<SlotMachin @register="registerSlotMachinModal" @success="handleSweep" />


const [wheelSweepModal, { openModal: openwheel }] = useModal();  
const [registerSweepModal, { openModal: openSweep }] = useModal();  
const [registerSlotMachinModal, { openModal: openMachin }] = useModal();


function handleOpenSweep(record: Recordable) {  
  console.log(record.type);  
  switch (record.type) {  
    case 'grid':  
      openSweep(true, {  
        isUpdate: true,  
        record: record,  
      });  
      break;  
    case 'wheel':  
      openwheel(true, {  
        isUpdate: true,  
        record: record,  
      });  
      break;  
    case 'tiger':  
      openMachin(true, {  
        isUpdate: true,  
        record: record,  
      });  
      break;  
    default:  
  }  
}

本页目录