【样式】默认都不选

文章描述了一个使用Vue.js编写的Web应用中,如何通过HTML和JavaScript实现佣金率和更新时间的动态切换,以及使用CSSFlex布局进行美化。组件间的交互通过data和methods属性实现。

在这里插入图片描述
在这里插入图片描述在这里插入图片描述在这里插入图片描述

html

<view class="u-flex u-m-t-32  u-m-b-24 u-f-s-24">
		<view class="u-flex" @click="navFun(1)">
			<text>佣金率</text>
			<image src="@/static/img/pai1.png" mode="" class="u-w-28 u-h-32" v-if="type1 == 1"></image>
			<image src="@/static/img/pai2.png" mode="" class="u-w-28 u-h-32" v-if="type1 == 2"></image>
			<image src="@/static/img/pai3.png" mode="" class="u-w-28 u-h-32" v-if="type1 == 3"></image>
		</view>
		<view class="u-flex u-m-l-32" @click="navFun(2)">
			<text>更新时间</text>
			<image src="@/static/img/pai1.png" mode="" class="u-w-28 u-h-32" v-if="type2 == 1"></image>
			<image src="@/static/img/pai2.png" mode="" class="u-w-28 u-h-32" v-if="type2 == 2"></image>
			<image src="@/static/img/pai3.png" mode="" class="u-w-28 u-h-32" v-if="type2 == 3"></image>
		</view>
	</view>

js

<script>
	export default {
		components: {},
		data() {
			return {
				type1:1,
				type2:1
			}
		},
		filters:{
			//取截单元,单位
			moneyFormat:function(arg){
				if(arg.toString().length>=4){
					const moneys = arg/10000
					const realVal = parseFloat(moneys).toFixed(2);
					return realVal+"w"
				}else {
					return arg
				}
			},
		},
		methods:{
			// num 1佣金率 2更新时间
			navFun(num){
				if(num == 1){
					this.type2 = 1;
					if(this.type1 == 1){
						this.type1 = 2
					}else if(this.type1 == 2){
						this.type1 = 3
					} else if(this.type1 == 3){
						this.type1 = 2
					}
				} else {
					this.type1 = 1;
					if(this.type2 == 1){
						this.type2 = 2
					}else if(this.type2 == 2){
						this.type2 = 3
					} else if(this.type2 == 3){
						this.type2 = 2
					}
				}
			},
			
		},
	}
</script>
<style lang='scss' scoped>
	.u-flex-center, .flex_align_center, .u-flex{
		display: flex;
		align-items: center;
	}
	.u-m-t-32{
		margin-top:32rpx;
	}
	.u-m-b-24{
		margin-bottom:32rpx;
	}
	.u-w-28{
		width:28rpx;
	}
	.u-h-28{
		height:28rpx;
	}
	.u-m-l-32{
		margin-left:32rpx;
	}
</style>
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值