欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

uniapp實(shí)現(xiàn)單選框的示例代碼

 更新時(shí)間:2024年03月01日 15:43:13   作者:狼性書(shū)生  
本文給大家介紹uniapp實(shí)現(xiàn)單選框的示例代碼,采用uniapp-vue3實(shí)現(xiàn)的一款單選框組件,提供絲滑的動(dòng)畫(huà)選中效果,支持不同主題配置,適配web、H5、微信小程序,感興趣的朋友跟隨小編一起看看吧

采用uniapp-vue3實(shí)現(xiàn)的一款單選框組件,提供絲滑的動(dòng)畫(huà)選中效果,支持不同主題配置,適配web、H5、微信小程序(其他平臺(tái)小程序未測(cè)試過(guò),可自行嘗試)

可到插件市場(chǎng)下載嘗試: https://ext.dcloud.net.cn/plugin?id=16821

使用示例

示例代碼

<template>
	<view>
		<view class="light" style="background-color: white">
			<wo-radio v-model:options="state.items" v-model:defaultValue="state.default" @on-change="changeEvent">
			</wo-radio>
		</view>
		<view class="light">
			<wo-radio v-model:options="state.items" v-model:defaultValue="state.default" v-model:styleObj="state.theme.light" v-slot="slotProps" @on-change="changeEvent">
				<view style="display: flex;">
					<view>{{ slotProps.data.name }}</view>
					<view class="tag">{{ slotProps.data.tag }}</view>
				</view>
			</wo-radio>
		</view>
		<view class="dark">
			<wo-radio v-model:options="state.items" v-model:defaultValue="state.default" v-model:styleObj="state.theme.dark" v-slot="slotProps" @on-change="changeEvent">
				<view style="display: flex;">
					<view>{{ slotProps.data.name }}</view>
					<view class="tag">{{ slotProps.data.tag }}</view>
				</view>
			</wo-radio>
		</view>
	</view>
</template>
<script setup lang="ts">
	import { reactive } from 'vue';
	const state = reactive({
	  items: [{
				value: '1',
				name: '蘋(píng)果味',
				tag: '飲料'
			},
			{
				value: '2',
				name: '香蕉味',
				tag: '酒水'
			},
			{
				value: '3',
				name: '火龍果味',
				tag: '飲料'
			},
			{
				value: '4',
				name: '西瓜味',
				tag: '飲料'
			},
			{
				value: '5',
				name: '哈密瓜味',
				tag: '酒水'
			},
			{
				value: '6',
				name: '榴蓮味',
				tag: '酒水'
		}],
		default: '2',
		theme: {
				light: {
					primary: 'blue',
					unselectedRadioBg: '#eaeaea',
					selectedBg: 'hsla(0,0%,100%,0.5)',
					height: 20
				},
				dark: {
					primary: 'blue',
					unselectedRadioBg: 'hsl(223,90%,30%)',
					selectedBg: 'hsla(223,90%,30%,0.5)',
					height: 20
				}
		},
		height: 12
	});
	const changeEvent = (el) => {
		console.log('點(diǎn)擊:', el);
	}
</script>
<style lang="scss" scoped>
	.light {
		border-radius: 10px;
		padding: 20rpx;
		font-size: 24rpx;
		background-color: hsl(223,90%,90%);
		margin: 20px;
		height: 300px;
		overflow: auto;
	}
	.dark {
		border-radius: 10px;
		padding: 20rpx;
		font-size: 24rpx;
		background-color: hsl(223,90%,10%);
		color: white;
		margin: 20px;
		height: 300px;
		overflow: auto;
	}
	.tag {
		background-color: #1BA035;
		color: white;
		font-size: 10px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 4px;
		padding: 0 4px;
		margin-left: 5px;
	}
</style>

到此這篇關(guān)于uniapp實(shí)現(xiàn)單選框的文章就介紹到這了,更多相關(guān)uniapp單選框內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • JS+CSS實(shí)現(xiàn)隨機(jī)點(diǎn)名(實(shí)例代碼)

    JS+CSS實(shí)現(xiàn)隨機(jī)點(diǎn)名(實(shí)例代碼)

    本文通過(guò)js html和cass代碼實(shí)現(xiàn)了隨機(jī)點(diǎn)名效果,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
    2019-11-11
  • 自己的js工具 Cookie 封裝

    自己的js工具 Cookie 封裝

    有些時(shí)候我們的web程序需要利用cookie來(lái)實(shí)現(xiàn)一些功能,很多時(shí)候我們并不需要非得用服務(wù)端來(lái)操作cookie,因?yàn)閖s可以也操作cookie.
    2009-08-08
  • JS常用正則表達(dá)式總結(jié)【經(jīng)典】

    JS常用正則表達(dá)式總結(jié)【經(jīng)典】

    這篇文章主要介紹了JS常用正則表達(dá)式,總結(jié)分析了常見(jiàn)的數(shù)字、字符、郵箱、身份證、電話(huà)等的正則驗(yàn)證技巧,需要的朋友可以參考下
    2017-05-05
  • Javascript之面向?qū)ο?-封裝

    Javascript之面向?qū)ο?-封裝

    本篇文章通過(guò)具體實(shí)例,對(duì)Javascript的封裝過(guò)程進(jìn)行案例分析,有助于對(duì)其代碼實(shí)現(xiàn)的理解與學(xué)習(xí)。下面就隨小編一起來(lái)看看吧
    2016-12-12
  • Bootstrap Tree View簡(jiǎn)單而優(yōu)雅的樹(shù)結(jié)構(gòu)組件實(shí)例解析

    Bootstrap Tree View簡(jiǎn)單而優(yōu)雅的樹(shù)結(jié)構(gòu)組件實(shí)例解析

    本文通過(guò)實(shí)例代碼給大家介紹了Bootstrap Tree View簡(jiǎn)單而優(yōu)雅的樹(shù)結(jié)構(gòu)組件,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-06-06
  • 簡(jiǎn)單實(shí)現(xiàn)Bootstrap標(biāo)簽頁(yè)

    簡(jiǎn)單實(shí)現(xiàn)Bootstrap標(biāo)簽頁(yè)

    這篇文章主要教大家簡(jiǎn)單實(shí)現(xiàn)Bootstrap標(biāo)簽頁(yè),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • 最新評(píng)論