国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

搖骰子設(shè)計(jì)與實(shí)現(xiàn)(uni-app微信小程序)

這篇具有很好參考價值的文章主要介紹了搖骰子設(shè)計(jì)與實(shí)現(xiàn)(uni-app微信小程序)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

搖骰子設(shè)計(jì)與實(shí)現(xiàn)

手機(jī)搖一搖可以搖骰子,上劃可查看結(jié)果,震動加聲音等功能。
本章底部會貼出所有代碼,圖片資源以及音頻資源很簡單,自己找一下就行了。
已經(jīng)上線小程序,可以掃碼直接預(yù)覽效果。
微信小程序篩子,uni-app,微信小程序,前端

準(zhǔn)備工作

新建一個項(xiàng)目,將已經(jīng)準(zhǔn)備好的資源,放入到項(xiàng)目中。下面是需要資源圖片的示例。
微信小程序篩子,uni-app,微信小程序,前端

實(shí)現(xiàn)步驟以及思路

作為一個前端,看到東西總是想著去實(shí)現(xiàn)一下。感覺搖骰子簡單就實(shí)現(xiàn)一下,如果難的話,可能就不會出來了。哈哈,開始上正文。
首先開始思考搖骰子的流程,準(zhǔn)備狀態(tài)>>>晃動中狀態(tài)>>>等待開起狀態(tài)>>>開啟后狀態(tài)。
簡單的四步循環(huán),開整。

第一步:實(shí)現(xiàn)準(zhǔn)備狀態(tài)

實(shí)現(xiàn)準(zhǔn)備狀態(tài),我們要實(shí)現(xiàn)什么?
1、手機(jī)搖一搖后開始搖骰子
開整,頁面如何鋪設(shè)就不描述了代碼在最下面。

利用uni.onGyroscopeChange監(jiān)聽陀螺儀,根據(jù)陀螺儀變化的速率來判斷是否搖動了手機(jī),當(dāng)檢測到搖動手機(jī)號開始游戲,并停止監(jiān)聽陀螺儀。
實(shí)際情況中發(fā)現(xiàn),搖動幅度大持續(xù)時間長,會執(zhí)行多次。這里我想的是加個shakeState變量,監(jiān)聽到一次的時候就改變 shakeState,然后停止監(jiān)聽后開始游戲。

			//監(jiān)聽陀螺儀
			start() {
				uni.onGyroscopeChange((res) => {
					var nowRange = Math.abs(res.x) + Math.abs(res.x) + Math.abs(res.x);
					if (nowRange > 10) {
						this.shakeState = true
					}
					if(this.shakeState){
						this.stop()
						this.shakeState = false
						this.playGame()
					}
				});
				uni.startGyroscope({
					interval: "normal"
				})
			},
			//停止監(jiān)聽陀螺儀
			stop() {
				uni.stopGyroscope({})
			},

第二步:實(shí)現(xiàn)晃動中狀態(tài)

實(shí)現(xiàn)晃動中狀態(tài),我們要實(shí)現(xiàn)什么?
1、整個骰盅晃動,發(fā)出搖骰子的聲音

骰盅晃動是通過vue中的**:class類樣式綁定,在代碼中寫了一個rollDiceAnimation**的樣式類實(shí)現(xiàn)一個動畫,然后判斷“gameType”的變量實(shí)現(xiàn)動畫。

<view class="diceCountent" :class="{'rollDiceAnimation':gameType == 1}">
</view>

聲音的是利用了“uni.createInnerAudioContext()”設(shè)置好自動播放,音頻文件地址,調(diào)用**onPlay()**方法實(shí)現(xiàn)聲音的播放。

					const innerAudioContext = uni.createInnerAudioContext();
					innerAudioContext.autoplay = true;
					innerAudioContext.src = '/static/rollDice/dice.mp3';
					innerAudioContext.onPlay(() => {});

第三步:等待開起狀態(tài)

實(shí)現(xiàn)晃動中狀態(tài),我們要實(shí)現(xiàn)什么?
1、上劃骰盅晃動,展示結(jié)果。

實(shí)現(xiàn)滑動,這里就不得不說下手指觸摸屏幕**“@touchstart”、觸摸移動“@touchmove”、手指離開屏幕“@touchend”這個三個事件。手指觸摸的時候記錄當(dāng)前pageY**的值,移動時算出移動的位置,改變骰盅的位置。手指離開后恢復(fù)原先的狀態(tài)。

原本想著,滑動骰盅直接展示結(jié)果,但是感覺太突然了。就使用“opacity”透明度顯得不那么突然。

<image class="maskbox" v-show="gameType != 3" :style="{'transform':'translate3d(0px,-'+yMove+'px,0)'}"
				@touchstart="maskTouchStart" @touchmove.prevent="maskTouchMove" @touchend="maskTouchEnd"
				src="../../static/rollDice/dice.png" mode=""></image>
			// 開始觸摸屏幕
			maskTouchStart(ev) {
				this.YStart = ev.changedTouches[0].pageY
			},
			// 觸摸移動
			maskTouchMove(ev) {
				var result =0
				if(this.gameType == 2){
					result =  parseInt(this.YStart - ev.changedTouches[0].pageY)
				}
				if(result > 0){
					this.yMove = result
					this.opacityShow = result/100
				}
			},
			// 觸摸結(jié)束
			maskTouchEnd(ev) {
				this.yMove = 0
				this.opacityShow = 0
			},

第四步:開啟后狀態(tài)

開啟后狀態(tài),我們要實(shí)現(xiàn)什么?
1、結(jié)果骰子的展示。

畢竟6個骰子和20個骰子展示是不一樣的。這里先定好要展示位置的大小,然后通過骰子的個數(shù),來改變骰子圖片的大小

			// 設(shè)置骰子位置前
			setDice() {
				var arr = [] 
				// 生成坐標(biāo)數(shù)組
				if (this.diceCount > 9) {
					let pointSum = Math.floor(Math.sqrt(this.diceCount)) + 1
					this.diceWidth = parseInt(240 / pointSum)
					for (let i = 0; i < pointSum; i++) {
						for (let k = 0; k < pointSum; k++) {
							arr[arr.length] = {
								top: i * this.diceWidth,
								left: k * this.diceWidth
							}
						}
					}
				} else {
					for (let i = 0; i < 3; i++) {
						for (let k = 0; k < 3; k++) {
							arr[arr.length] = {
								top: i * 80,
								left: k * 80
							}
						}
					}
				}
				// 骰子位置以及角度
				var dice, angle, temp, tempList
				for (var i = 0; i < this.diceCount; i++) {
					dice = (Math.random() * 6) >> 0
					angle = (Math.random() * 6) >> 0
					temp = (Math.random() * arr.length) >> 0;
					// 讓數(shù)組不重復(fù)
					tempList = arr[temp];
					arr.splice(temp, 1)
					this.addDiceList(dice, angle, tempList)
				}
			},
			// 設(shè)置骰子
			addDiceList(dice, angle, tempList) {
				this.diceList.push({
					"rotate": 30 * angle,
					"dice": dice,
					"top": tempList.top,
					"left": tempList.left
				})
			},

部分優(yōu)化

總體的功能就實(shí)現(xiàn)了,為了更加完善。設(shè)置彈框、歷史開骰記錄、準(zhǔn)備狀態(tài)下顯示骰子數(shù)量等待開起狀態(tài)開始陀螺儀監(jiān)聽可繼續(xù)搖。這就不多說了,具體的邏輯代碼都在下面。

代碼和我,只要一個能跑就行!文章來源地址http://www.zghlxwxcb.cn/news/detail-663663.html

總代碼

<template>
	<view>
		<!-- 背景 -->
		<image class="gameBg" src="../../static/rollDice/gameBg.jpg" mode=""></image>
		<view style="height: 60rpx;"></view>
		<!-- 骰子 -->
		<view class="diceCountent" :class="{'rollDiceAnimation':gameType == 1}">
			<image src="../../static/rollDice/dicebg.png" class="bgimg" mode=""></image>
			<view class="dicebox">
				<view class="diceitem" v-for="(item,index) in diceList" :key="index" :style="{width:diceWidth+'rpx',height:diceWidth+'rpx',top:item.top+'rpx',left:item.left+'rpx',
		transform:`rotate(${item.rotate}deg)`}">
					<image :src="diceAll[item.dice].img" class="diceimg" mode=""></image>
				</view>
			</view>

			<image class="maskbox" v-show="gameType != 3" :style="{'transform':'translate3d(0px,-'+yMove+'px,0)'}"
				@touchstart="maskTouchStart" @touchmove.prevent="maskTouchMove" @touchend="maskTouchEnd"
				src="../../static/rollDice/dice.png" mode=""></image>
			<view v-show="gameType == 0" class="diceSumBox">
				{{diceCount}}
			</view>
			<view v-show="gameType == 2" class="diceSumBox">

			</view>
		</view>
		<!-- 總合計(jì) -->
		<view style="height: 800rpx;"></view>
		<!-- 按鈕-->
		<view class="btnBox">
			<view v-show="gameType == 0" @click="playGame()" class="startBtn">
				搖一搖
			</view>
			<view v-show="gameType == 2" @click="openDice()" class="openBtn"></view>
		</view>
		<!-- v-show="gameType == 3" -->
		<view :style="{'opacity':opacityShow}"  class="totalbox">
			<text class="totalboxTitle">總點(diǎn)數(shù):{{point}}</text>
			<view class="totaldicebox">
				<view class="totaldiceItem">
					<image src="../../static/rollDice/01.png" class="smallDiceimg" mode=""></image>
					<text>X {{one}}</text>
				</view>
				<view class="totaldiceItem">
					<image src="../../static/rollDice/03.png" class="smallDiceimg" mode=""></image>
					<text>X {{thr}}</text>
				</view>
				<view class="totaldiceItem">
					<image src="../../static/rollDice/05.png" class="smallDiceimg" mode=""></image>
					<text>X {{fiv}}</text>
				</view>
			</view>
			<view class="totaldicebox">
				<view class="totaldiceItem">
					<image src="../../static/rollDice/02.png" class="smallDiceimg" mode=""></image>
					<text>X {{two}}</text>
				</view>
				<view class="totaldiceItem">
					<image src="../../static/rollDice/04.png" class="smallDiceimg" mode=""></image>
					<text>X {{fou}}</text>
				</view>
				<view class="totaldiceItem">
					<image src="../../static/rollDice/06.png" class="smallDiceimg" mode=""></image>
					<text>X {{six}}</text>
				</view>
			</view>
		</view>
		
		<view class="smallTipBox">
			<text v-show="gameType == 2">上劃骰盅可提前查看結(jié)果</text>
			<text v-show="gameType == 3">點(diǎn)擊右下角可重新開始</text>
		</view>
		
		<!-- 記錄 -->
		<view class="footBox">
			<image @click="setRecord()" src="../../static/rollDice/record.png" class="recordImg" mode=""></image>
			<view v-show="gameType == 2" @click="playGame()" class="againBtn"></view>
			<view v-show="gameType == 3" @click="reface()" class="againBtn">
				復(fù)
			</view>
		</view>
		<view v-show="recordShow" class="recordBox">
			<view @click="recordShow = false" class="closeBox">
				X
			</view>
			<view class="title">
				歷史開骰記錄
			</view>
			<view class="headTitle">
				<view class="whead">總和</view>
				<image src="../../static/rollDice/01.png" class="diceRecordimg" mode=""></image>
				<image src="../../static/rollDice/02.png" class="diceRecordimg" mode=""></image>
				<image src="../../static/rollDice/03.png" class="diceRecordimg" mode=""></image>
				<image src="../../static/rollDice/04.png" class="diceRecordimg" mode=""></image>
				<image src="../../static/rollDice/05.png" class="diceRecordimg" mode=""></image>
				<image src="../../static/rollDice/06.png" class="diceRecordimg" mode=""></image>
			</view>
			<scroll-view scroll-y="true" class="diceContentBox">
				<view v-for="(item,index) in recordList" :key="index" class="diceContent">
					<text class="whead">{{item.point}}點(diǎn)</text>
					<text>{{item.one}}</text>
					<text>{{item.two}}</text>
					<text>{{item.thr}}</text>
					<text>{{item.fou}}</text>
					<text>{{item.fiv}}</text>
					<text>{{item.six}}</text>
				</view>
			</scroll-view>

		</view>
		<!-- 設(shè)置 -->
		<!-- 左上角設(shè)置,可設(shè)置音樂,震動,篩子個數(shù),自動開 -->
		<view @click="setBoxShow = true" class="setBtn">
			<image src="../../static/set.png" mode=""></image>
		</view>
		<view v-show="setBoxShow" class="setBox">
			<view @click="setBoxShow = false" class="closeBox">
				X
			</view>
			<view class="title">
				設(shè)置
			</view>
			<view @click="automated = !automated" class="handleBtn">
				自動開骰:{{automated?'開啟':'關(guān)閉'}}
			</view>
			<view @click="musicshow = !musicshow" class="handleBtn">
				聲音:{{musicshow?'開啟':'關(guān)閉'}}
			</view>
			<view @click="shakeShow = !shakeShow" class="handleBtn">
				震動:{{shakeShow?'開啟':'關(guān)閉'}}
			</view>
			<view class="handleBtn setCountBox">
				<text>骰子:</text>
				<image @click="setcount()" src="../../static/rollDice/reduce.png" mode=""></image>
				<text style="width: 100rpx;">{{diceCount}}</text>
				<image @click="setcount('add')" src="../../static/rollDice/add.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shakeState:false, // 搖一搖
				opacityShow:0, // 統(tǒng)計(jì)透明度
				YStart:'', // 開始位置
				yMove: 0,
				setBoxShow: false, // 設(shè)置
				musicshow: true, // 音樂
				shakeShow:true, // 震動
				automated: false, // 自動開
				recordShow: false, // 記錄
				gameType: 0, // 0:游戲準(zhǔn)備,1搖骰子中,2等待開篩子,3已經(jīng)開過篩子
				point: 0,
				one: 0,
				two: 0,
				thr: 0,
				fou: 0,
				fiv: 0,
				six: 0,
				diceCount: 6,
				diceWidth: 70,
				diceList: [],
				diceAll: [{
					img: '../../static/rollDice/01.png',
					dicesum: 1
				}, {
					img: '../../static/rollDice/02.png',
					dicesum: 2
				}, {
					img: '../../static/rollDice/03.png',
					dicesum: 3
				}, {
					img: '../../static/rollDice/04.png',
					dicesum: 4
				}, {
					img: '../../static/rollDice/05.png',
					dicesum: 5
				}, {
					img: '../../static/rollDice/06.png',
					dicesum: 6
				}],
				recordList: [],
			}
		},
		onShow() {
			// this.playGame()
			this.start()
		},
		methods: {
			// 開始觸摸屏幕
			maskTouchStart(ev) {
				this.YStart = ev.changedTouches[0].pageY
			},
			// 觸摸移動
			maskTouchMove(ev) {
				var result =0
				if(this.gameType == 2){
					result =  parseInt(this.YStart - ev.changedTouches[0].pageY)
				}
				if(result > 0){
					this.yMove = result
					this.opacityShow = result/100
				}
			},
			// 觸摸結(jié)束
			maskTouchEnd(ev) {
				this.yMove = 0
				this.opacityShow = 0
			},
			//監(jiān)聽陀螺儀
			start() {
				uni.onGyroscopeChange((res) => {
					var nowRange = Math.abs(res.x) + Math.abs(res.x) + Math.abs(res.x);
					if (nowRange > 10) {
						this.shakeState = true
					}
					
					if(this.shakeState){
						this.stop()
						this.shakeState = false
						this.playGame()
					}
				});
				uni.startGyroscope({
					interval: "normal"
				})
			},
			//停止監(jiān)聽陀螺儀
			stop() {
				uni.stopGyroscope({})
			},
			setcount(txt) {
				if (txt == 'add') {
					if (this.diceCount < 100) {
						this.diceCount++
					}
				} else {
					if (this.diceCount > 1) {
						this.diceCount--
					}
				}
			},
			// 查看記錄
			setRecord() {
				this.recordShow = true
			},
			// 開起骰子
			openDice() {
				this.opacityShow = 1
				this.gameType = 3
				this.stop()
			},
			// 重置游戲
			reface() {
				this.opacityShow = 0
				this.gameType = 0
				this.diceList = []
				this.recordList[this.recordList.length] = {
					'point': this.point,
					'one': this.one,
					'two': this.two,
					'thr': this.thr,
					'fou': this.fou,
					'fiv': this.fiv,
					'six': this.six,
				}
				this.start()
			},
			// 開始游戲
			playGame() {
				this.diceList = []
				// 震動
				if(this.shakeShow){
					uni.vibrateLong();
				}
				
				if(this.musicshow){
					const innerAudioContext = uni.createInnerAudioContext();
					innerAudioContext.autoplay = true;
					innerAudioContext.src = '/static/rollDice/dice.mp3';
					innerAudioContext.onPlay(() => {});
				}
				
				this.setDice()
				this.diceCountDice()
				

				this.gameType = 1

				// 自動開骰
				if (this.automated) {
					setTimeout(() => {
						this.gameType = 3
						this.opacityShow = 1
					}, 2000)
				} else {
					setTimeout(() => {
						this.gameType = 2
						this.start()
					}, 2000)
				}
			},
			// 設(shè)置骰子位置前
			setDice() {
				var arr = [] // 深拷貝
				// 生成坐標(biāo)數(shù)組
				if (this.diceCount > 9) {
					let pointSum = Math.floor(Math.sqrt(this.diceCount)) + 1
					this.diceWidth = parseInt(240 / pointSum)
					for (let i = 0; i < pointSum; i++) {
						for (let k = 0; k < pointSum; k++) {
							arr[arr.length] = {
								top: i * this.diceWidth,
								left: k * this.diceWidth
							}
						}
					}
				} else {
					for (let i = 0; i < 3; i++) {
						for (let k = 0; k < 3; k++) {
							arr[arr.length] = {
								top: i * 80,
								left: k * 80
							}
						}
					}
				}

				var dice, angle, temp, tempList
				for (var i = 0; i < this.diceCount; i++) {
					dice = (Math.random() * 6) >> 0
					angle = (Math.random() * 6) >> 0
					temp = (Math.random() * arr.length) >> 0;
					// 讓數(shù)組不重復(fù)
					tempList = arr[temp];
					arr.splice(temp, 1)
					this.addDiceList(dice, angle, tempList)
				}
			},
			// 設(shè)置骰子
			addDiceList(dice, angle, tempList) {
				this.diceList.push({
					"rotate": 30 * angle,
					"dice": dice,
					"top": tempList.top,
					"left": tempList.left
				})
			},
			// 統(tǒng)計(jì)數(shù)量
			diceCountDice() {
				this.one = 0
				this.two = 0
				this.thr = 0
				this.fou = 0
				this.fiv = 0
				this.six = 0
				let sum = 0
				this.diceList.forEach((item) => {
					sum = sum + item.dice + 1
					switch (item.dice) {
						case 0:
							this.one++;
							break;
						case 1:
							this.two++;
							break;
						case 2:
							this.thr++;
							break;
						case 3:
							this.fou++;
							break;
						case 4:
							this.fiv++;
							break;
						case 5:
							this.six++;
							break;
					}
				})
				this.point = sum
			}


		}
	}
</script>

<style lang="scss">
	.gameBg {
		position: fixed;
		width: 750rpx;
		height: 100vh;
	}

	/* 骰子 */
	.diceCountent {
		position: absolute;
		left: 130rpx;
		padding-top: 60rpx;

		.bgimg {
			position: absolute;
			top: 270rpx;
			width: 500rpx;
			height: 520rpx;
		}

		.dicebox {
			position: relative;
			top: 330rpx;
			margin-left: 110rpx;
			z-index: 10;
		}

		.diceitem {
			position: absolute;
		}

		.diceimg {
			width: 100%;
			height: 100%;
		}

		.maskbox {
			position: absolute;
			margin-left: 40rpx;
			width: 430rpx;
			height: 600rpx;
			z-index: 10;
		}

		.diceSumBox {
			position: absolute;
			top: 340rpx;
			margin-left: 40rpx;
			font-size: 160rpx;
			font-weight: bold;
			color: #d2d1d9;
			z-index: 10;
			width: 430rpx;
			text-align: center;
		}
	}

	.rollDiceAnimation {
		animation: moveRoll 1.2s;
	}

	@keyframes moveRoll {
		0% {
			left: 130rpx;
		}

		5% {
			left: 0rpx;
		}

		15% {
			left: 260rpx;
		}

		25% {
			left: 0rpx;
		}

		35% {
			left: 260rpx;
		}

		45% {
			left: 0rpx;
		}

		55% {
			left: 260rpx;
		}

		65% {
			left: 0rpx;
		}

		75% {
			left: 260rpx;
		}

		85% {
			left: 0rpx;
		}

		95% {
			left: 260rpx;
		}

		100% {
			left: 130rpx;
		}
	}

	// 結(jié)果統(tǒng)計(jì)
	.totalbox {
		color: #FFFFFF;
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 640rpx;
		border-radius: 30rpx;
		margin: 10rpx auto 0;
		padding: 0 20rpx 10rpx;
		border: 6rpx #7b422e solid;
		// background: linear-gradient(#FFFFFF, #0ba952);
		position: relative;

		.totalboxTitle {
			font-size: 50rpx;
			line-height: 100rpx;
		}

		.smallDiceimg {
			width: 80rpx;
			height: 80rpx;
		}

		.totaldicebox {
			display: flex;
			width: 100%;
			padding: 10rpx 0;
		}

		.totaldiceItem {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.totaldiceItem text {
			margin-left: 10rpx;
			font-size: 42rpx;
		}

	}

	.btnBox {
		display: flex;
		justify-content: center;
		position: relative;
		text-align: center;
		z-index: 10;
		font-size: 46rpx;

		.startBtn {
			width: 200rpx;
			border: 2rpx #f6f6f7 solid;
			color: #FFFFFF;
			padding: 0 60rpx;
			line-height: 80rpx;
			border-radius: 40rpx;
			background: #303038;
		}

		.openBtn {
			font-size: 54rpx;
			line-height: 160rpx;
			text-align: center;
			width: 160rpx;
			height: 160rpx;
			border-radius: 100rpx;
			border: 2rpx #f6f6f7 solid;
			color: #FFFFFF;
			background: #303038;
		}
	}

	// 歷史記錄
	.recordBox {
		position: fixed;
		bottom: 0;
		width: 670rpx;
		height: 60vh;
		z-index: 10;
		background: #faf5ec;
		border: 10rpx #755345 solid;
		padding: 20rpx 30rpx;
		border-radius: 50rpx 50rpx 0 0;

		.title {
			width: 100%;
			font-weight: bold;
			line-height: 120rpx;
			font-size: 40rpx;
			text-align: center;
		}

		.closeBox {
			position: absolute;
			right: 0;
			top: 0;
			font-size: 40rpx;
			font-weight: bold;
			padding: 20rpx 30rpx;
		}

		.headTitle {
			display: flex;
			align-items: center;
			justify-content: space-around;

			.whead {
				font-weight: bold;
				text-align: center;
				width: 110rpx;
			}

			.diceRecordimg {
				width: 54rpx;
				height: 54rpx;
			}
		}

		.diceContentBox {
			height: 40vh;
			margin-top: 20rpx;
			overflow: hidden;
			border: 2rpx #c1c1c1 solid;
		}

		.diceContent {
			display: flex;
			align-items: center;
			color: #333333;
			justify-content: space-around;
			line-height: 70rpx;
			border-bottom: 2rpx #999 solid;

			.whead {
				text-align: center;
				width: 110rpx;
			}

			text {
				width: 54rpx;
				text-align: center;
			}
		}
	}

	.footBox {
		position: fixed;
		width: 650rpx;
		display: flex;
		justify-content: space-between;
		bottom: 50rpx;
		left: 50rpx;

		.recordImg {
			width: 90rpx;
			height: 90rpx;
		}

		.againBtn {
			color: #FFFFFF;
			font-size: 40rpx;
			text-align: center;
			font-weight: bold;
			width: 90rpx;
			line-height: 90rpx;
			height: 90rpx;
			border-radius: 100rpx;
			border: 6rpx #FFFFFF solid;
		}
	}

	// 設(shè)置
	.setBtn {
		position: fixed;
		top: 80rpx;
		left: 40rpx;

		image {
			width: 80rpx;
			height: 80rpx;
		}
	}

	.setBox {
		z-index: 10;
		position: fixed;
		top: 26vh;
		left: 110rpx;
		color: #442e27;
		border: 10rpx #755345 solid;
		border-radius: 30rpx;
		padding: 0 50rpx 50rpx 50rpx;
		background: #faf5ec;

		.title {
			width: 100%;
			font-weight: bold;
			line-height: 140rpx;
			font-size: 40rpx;
			text-align: center;
		}

		.handleBtn {
			border-radius: 30rpx;
			font-size: 34rpx;
			font-weight: bold;
			line-height: 70rpx;
			text-align: center;
			width: 400rpx;
			background: #f7d16a;
			border: 6rpx #6c5447 solid;
			margin-bottom: 20rpx;
		}

		.closeBox {
			position: absolute;
			right: 0;
			font-size: 40rpx;
			font-weight: bold;
			padding: 10rpx 20rpx;
		}

		.setCountBox {
			display: flex;
			align-items: center;
			justify-content: center;

			image {
				width: 40rpx;
				height: 40rpx;
				padding: 0 10rpx;
			}
		}
	}
	
	.smallTipBox{
		position: relative;
		color: #FFFFFF;
		font-size: 36rpx;
		line-height: 120rpx;
		width: 100%;
		text-align: center;
	}
</style>

到了這里,關(guān)于搖骰子設(shè)計(jì)與實(shí)現(xiàn)(uni-app微信小程序)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • uni-app實(shí)現(xiàn)點(diǎn)擊顯示隱藏列表,兼容微信小程序

    uni-app實(shí)現(xiàn)點(diǎn)擊顯示隱藏列表,兼容微信小程序

    效果:? ? 小程序打印的結(jié)果:值一直為true ? 如果你試過v-if不生效,又試了v-show,還是不行??!千萬不要著急! 不是自己寫的不對,而是uni-app和微信小程序修改值的方式不一致造成的。反正就是不承認(rèn)是自己的問題。 其實(shí)解決的辦法也很簡單,就是要兼容兩端,寫出符合

    2024年02月09日
    瀏覽(34)
  • uni-app實(shí)現(xiàn)自定義導(dǎo)航欄,兼容H5、App、微信小程序

    uni-app實(shí)現(xiàn)自定義導(dǎo)航欄,兼容H5、App、微信小程序

    很多情況下,系統(tǒng)自帶的導(dǎo)航欄無法滿足UI設(shè)計(jì)的要求,這時候就需要我們自定義導(dǎo)航欄來實(shí)現(xiàn)需求,要考慮跨端的多種情況,這里我們封裝成一個組件來使用,實(shí)現(xiàn)效果如下: 一、H5、App、微信小程序的區(qū)別 1.H5:導(dǎo)航欄高度可以設(shè)為44px,它沒有狀態(tài)欄,因?yàn)镠5端運(yùn)行在瀏覽

    2024年04月13日
    瀏覽(105)
  • Uni-app實(shí)現(xiàn)左右滑動頁面內(nèi)容切換(兼容微信小程序)

    提示:文章寫完后,目錄可以自動生成,如何生成可參考右邊的幫助文檔 ? ? ? ? 前言 ? ? ? ? 整體思路 ? ? ? ??一、HTML部分 ????????二、Script部分 ????????三、Style部分 ? ? ? ? ? (先聲明哦我可不是偷懶,只是想學(xué)術(shù)借鑒一下)因?yàn)樽罱性谧鲎笥一瑒庸δ埽?/p>

    2024年02月07日
    瀏覽(112)
  • uni-app之微信小程序?qū)崿F(xiàn)‘下載+保存至本地+預(yù)覽’功能

    uni-app之微信小程序?qū)崿F(xiàn)‘下載+保存至本地+預(yù)覽’功能

    目錄 一、H5如何實(shí)現(xiàn)下載功能 二、微信小程序?qū)崿F(xiàn)下載資源功能方面與H5有很大的不同 三、?微信小程序?qū)崿F(xiàn)文件(doc,pdf等格式,非圖片)下載(下載-保存-預(yù)覽)功能 四、圖片預(yù)覽、保存、轉(zhuǎn)發(fā)、收藏:uni.previewImage() 五、 我當(dāng)前遇到‘關(guān)于文件預(yù)覽uni.openDocument()’API的問

    2024年02月15日
    瀏覽(31)
  • 微信小程序使用uni-app開發(fā)小程序及部分功能實(shí)現(xiàn)詳解心得

    目錄 一、uni-app 1、簡介 2、開發(fā)工具 3、新建 uni-app項(xiàng)目 4、把項(xiàng)目運(yùn)行到微信開發(fā)者工具 二、實(shí)現(xiàn)tabBar效果 1、創(chuàng)建tabBar頁面 2、配置tabBar 1、創(chuàng)建分包目錄 2、在 pages.json 文件中配置 3、創(chuàng)建分包頁面 四、公用方法封裝 五、搜索功能 1、搜索組件 2、搜索建議實(shí)現(xiàn) 3、本地存儲

    2024年02月11日
    瀏覽(23)
  • uni-app 微信小程序中如何通過 canvas 畫布實(shí)現(xiàn)電子簽名?

    uni-app 微信小程序中如何通過 canvas 畫布實(shí)現(xiàn)電子簽名?

    一、實(shí)際應(yīng)用場景 電子簽名軟件應(yīng)用場景:電子簽名在金融、銀行、貸款行業(yè)中可以用于對內(nèi)日常辦公流轉(zhuǎn)的文檔的蓋章簽字,對外涉及業(yè)務(wù)合作協(xié)議,采購合同,貸款申請、信用評估、貸款合同、貸款文件表、說明函等等。 可以說,只要是涉及紙質(zhì)文檔簽字蓋章的場景,

    2024年02月10日
    瀏覽(25)
  • uni-app-微信小程序?qū)崿F(xiàn)markdown文本解析、數(shù)學(xué)公式解析超詳細(xì)教程

    uni-app-微信小程序?qū)崿F(xiàn)markdown文本解析、數(shù)學(xué)公式解析超詳細(xì)教程

    在做AI問答功能,文本返回的是markdown形式,如果沒有對Markdown文本進(jìn)行轉(zhuǎn)換很難看,如下圖,轉(zhuǎn)換后是不是很好了很多,特別是代碼內(nèi)容閱讀起來舒服多了。 下面來介紹下,我在開發(fā)小程序 軟件聚導(dǎo)航 AI助手對實(shí)現(xiàn)Markdown文本解析,看到兩款較好的組件,其中第二款towxml組件

    2024年02月03日
    瀏覽(132)
  • uni-app的Vue.js實(shí)現(xiàn)微信小程序的緊急事件登記頁面功能

    uni-app的Vue.js實(shí)現(xiàn)微信小程序的緊急事件登記頁面功能

    主要功能實(shí)現(xiàn)? 完成發(fā)生時間選擇功能,用戶可以通過日期選擇器選擇事件發(fā)生的時間。 實(shí)現(xiàn)事件類型選擇功能,用戶可以通過下拉選擇框選擇事件的類型。 添加子養(yǎng)殖場編號輸入框,用戶可以輸入與事件相關(guān)的子養(yǎng)殖場編號。 完成事件描述輸入功能,用戶可以通過文本輸

    2024年02月12日
    瀏覽(30)
  • 即時通訊實(shí)現(xiàn)微信掃碼登錄web網(wǎng)站(vue + uni-app + java + 微信小程序)
  • 微信小程序uni-app

    微信小程序uni-app

    小程序 是一種不需要下載、安裝即可使用的應(yīng)用,它實(shí)現(xiàn)了應(yīng)用觸手可及的夢想,用戶掃一掃或者搜一下就能打開應(yīng)用,也實(shí)現(xiàn)了用完即走的理念,用戶不用安裝太多應(yīng)用,應(yīng)用隨處可用,但又無須安裝卸載。 微信開發(fā)文檔 1、工作原理 網(wǎng)頁開發(fā),渲染線程和腳本是互斥的

    2024年02月10日
    瀏覽(105)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包