这篇文章主要是简单的实现了vue2.0移动端自定义性别选择的功能,很简单但是经常用到,于是写了一个小小的demo,记录下来。
效果图:
图片.png
实现代码:
<template>
<div class="app">
<div class="boy">
<input type="radio" name="radios" value="1" v-model="param"><label>男</label>
</div>
<div class="girl">
<input type="radio" name="radios" value="2" v-model="param"><label>女</label>
</div>
</div></template><script>
export default {
data() { return { param: '1' //设置默认值为1,即设置第一个单选框为选中状态
}
}, methods: {
}
};</script><style>
.app{ height:60px; background: #fff;
border: 1px solid #f1ebeb;
} .boy{ height:30px; background: fff; border-bottom: 1px solid #f1ebeb;
} .boy input{ text-align: center;
} .boy label{ text-align: center;
}
.girl{ height:30px; background: fff;
}</style>原文作者:祈澈姑娘
作者:祈澈菇凉
链接:https://www.jianshu.com/p/f998f6f580c
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
