其他分享
首页 > 其他分享> > Vue 幸运大转盘

Vue 幸运大转盘

作者:互联网

转盘抽奖主要有两种,指针转动和转盘转动,个人觉得转盘转动比较好看点,指针转动看着头晕,转盘转动时指针是在转盘的中间位置,这里要用到css的transform属性和transition属性,这两个因为不常用最好是上网查查,用法和功能。

  在html部分

  

<div id="wheel_surf">
      <div class="wheel_surf_title">幸运大转盘</div>
       <div class="lucky-wheel">
             <div class="wheel-main">
                  <div class="wheel-pointer-box">
                         <div class="wheel-pointer" @click="rotate_handle()" :style="{transform:rotate_angle_pointer,transition:rotate_transition_pointer}"></div>
                   </div>              
                   <div class="wheel-bg" :style="{transform:rotate_angle,transition:rotate_transition}">                  
                         <div class="prize-list">
                                <div class="prize-item" v-for="(item,index) in prize_list" :key="index">
                                       <div class="prize-pic" v-if="item.icon">
                                               <img :src="item.icon" />
                                        </div>
                                        <div class="prize-type">
{{item.name}}</div>
                                     </div>
                               </div>
                         </div>
                    </div>
                </div>
                <div v-transfer-dom>
                    <x-dialog v-model="showHideOnBlur" class="dialog-demo wheel_dialog" hide-on-blur>
                        <div class="img-box">
                            <div v-show="val == 7" class="noactive">
                                <p>谢谢参与!祝您下次好运</p>
                            </div>
                            <div v-show="val !== 7">
                                <p>恭喜你</p>
                                <img :src="imgActive" />
                                <p>{{item.rewardDesc}}</p> // 获奖返回值
                            </div>
                        </div>
                        <div @click="showHideOnBlur=false">
                            <span class="vux-close"></span>
                        </div>
                    </x-dialog>
                </div>
            </div>

 

标签:Vue,转动,大转盘,item,幸运,转盘,指针
来源: https://www.cnblogs.com/muzimumu/p/10819888.html