uni-app根据单选框页面切换

本文介绍了一个用于选择不同业务类型的UI组件实现方案,包括数字业务、宽带业务和互动业务的选择界面,通过Vue.js进行开发,并详细展示了组件的结构、样式及交互逻辑。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在这里插入图片描述

<template>
	<view class="vCheckBreakdown">

		<view class="divider-class"></view>
		<view class="form-class">

			<view class="end-title">
				<view>类型</view>

				<view v-for="(item,index) in items" :key="index" :class="{btna:count == index}" @tap="change(index)">
					<view class="shar-item-ckb" @click="timedata(index)">
						<uni-icons :type="index == iconSelect?'circle-filled':'circle'" :size="20" color="#05928B">
						</uni-icons>
						{{item}}
					</view>

				</view>
			</view>
			<view class="end-cont" :class="{dis:btnnum == 4}">
				
				<digitalBusiness @clickIcon="clickIcon"  ref="digitalBusiness"></digitalBusiness>

			</view>
			<view class="end-cont" :class="{dis:btnnum == 1}">
				
				<broadbandServices @clickIcon="clickIcon" ref="broadbandServices"></broadbandServices>
				
			</view>
			<view class="end-cont" :class="{dis:btnnum == 2}">
				<interactiveBusiness @clickIcon="clickIcon" ref="interactiveBusiness"></interactiveBusiness>
			</view>
			<view class="query-btn display-flex-allcenter-column"  @click="queGatewayFault">提交</view>

		</view>


		


	</view>
</template>

<script>
	import broadbandServices from './components/broadbandServices.vue';
	import digitalBusiness from './components/digitalBusiness.vue';
	import interactiveBusiness from './components/interactiveBusiness.vue';


	export default {
		data() {
			return {
				
				
				btnnum: 0,
				items: ['数字业务', '宽带业务', '互动业务'],
				count: "",
				iconSelect: 0,
				icon: "circle-filled",
				permark:1,
			};
		},

		beforeCreate() {
			uni.$on('localCustSuccess', () => {
				this.initData();
			});
		},

		created() {
			if (!this.custInfo) {
				this.initData();
			}
		},

		//标题栏点击
		onNavigationBarButtonTap: function(obj) {
			if (obj.index == 0 && window.baseAppJs) {
				window.baseAppJs.back();
			} else {
				window.history.back()
			}
		},

		components: {
			broadbandServices,
			digitalBusiness,
			interactiveBusiness
		},

		computed: {

		},

		watch: {
			servs: {
				handler(newVal) {
					if (newVal && newVal.length > 0) {
						this.serv = newVal[this.currentDevIndex];
					}
				},
				// 代表在wacth里声明了firstName这个方法之后立即先去执行handler方法
				immediate: true
			},
			currentDevIndex: {
				handler(newVal) {
					if (this.servs && this.servs.length > 0) {
						this.serv = this.servs[newVal];
					}
				}
			},
			serv: {
				handler(newVal) {
					this.labels = this.getLabels(newVal);
					this.equipments = this.getEquipments(newVal);
				}
			}
		},

		methods: {
			initData() {


			},

			getLabels(servItem) {
				return servItem.permark.map((permarkItem, index) => {
					return {
						labelName: permarkItem.value || '未知业务'
					};
				});
			},

			
            // 下面两个方法是切换页面方法
			change(e) {
				this.count = e
			 this.btnnum = e
				console.log(this.count)
			},
			timedata(id) {
				this.iconSelect = id;
				console.log("timedata===" + id)
				
			},
			
			

		}
	};
</script>

<style lang="scss" scoped>
	@import 'index.scss';

	/* 将三个内容view的display设置为none(隐藏) */
	.end-title {
		display: flex;
		padding-top: 20rpx;
	}

	.end-title view {
		flex-grow: 1;
		text-align: center;
	}

	.end-cont {
		display: none;
		background: #C8C7CC;
	}

	.btna {
		color: #FFFFFF;
		background: #ffffff;
	}

	.dis {
		display: block;
	}
	
	.display-flex-allcenter-column{
		background-color: #FF761E;
		    margin: 1px 5%;
	}
	
	
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值