feat: 去掉调试代码,录屏

This commit is contained in:
Burt 2024-01-10 20:45:09 +08:00
parent eca4c9f7c0
commit fd090a2d86
2 changed files with 8 additions and 17 deletions

BIN
src/pages/demo/lottery2.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -8,12 +8,16 @@
<view class="mt-4 h-10 text-center">大转盘抽奖</view> <view class="mt-4 h-10 text-center">大转盘抽奖</view>
<div class="lottery-box"> <div class="lottery-box">
<div class="lottery-list"> <div class="lottery-list">
<div class="lottery-item" v-for="(n, index) in 1" :key="n"> <div class="lottery-item" v-for="(n, index) in giftLen" :key="n">
<div class="lottery-item-inner"> <div class="lottery-item-inner">
<div class="lottery-item-gift">奖品{{ index + 1 }}</div> <div class="lottery-item-gift">奖品{{ index + 1 }}</div>
</div> </div>
</div> </div>
<div ref="pointer" class="pointer" @click="handleClick"> <div
class="pointer"
@click="handleClick"
:style="{ transform: `rotate(${state.stopDeg}deg)` }"
>
<div>开始</div> <div>开始</div>
<div>抽奖</div> <div>抽奖</div>
</div> </div>
@ -40,8 +44,6 @@ const state = reactive({
loading: false, loading: false,
}) })
const pointer = ref()
function handleClick() { function handleClick() {
if (state.loading) return if (state.loading) return
state.loading = true state.loading = true
@ -50,8 +52,6 @@ function handleClick() {
console.log(state.lottery) console.log(state.lottery)
// +0+ // +0+
state.stopDeg += (state.lottery + (giftLen - state.lastLottery)) * deg + loop * 360 state.stopDeg += (state.lottery + (giftLen - state.lastLottery)) * deg + loop * 360
//
pointer.value.style.transform = `rotate(${state.stopDeg}deg)`
// uniaddEventListener // uniaddEventListener
setTimeout(() => { setTimeout(() => {
@ -63,14 +63,6 @@ function handleClick() {
}) })
}, 3000) }, 3000)
} }
//
// pointer.value.addEventListener('transitionend', () => {
// alert(`${state.lottery + 1}`)
// //
// state.lastLottery = state.lottery
// state.loading = false
// })
</script> </script>
<style lang="scss"> <style lang="scss">
@ -100,9 +92,8 @@ function handleClick() {
left: var(--half); left: var(--half);
width: var(--half); width: var(--half);
height: var(--size); height: var(--size);
overflow: hidden; //
// overflow: hidden; // // background-color: #ff5350a1; //
background-color: #ff5350a1; //
transform-origin: left center; transform-origin: left center;
} }