v-model

<template>
<!--用户页面-选择关注-->
<div class="follow">
<h4>选择关注</h4>
<p>请选择您感兴趣的分类,给您最精准的推荐</p>
<div>
<ul class="flexStart">
<li v-for="(item,index) in followLists" :key="index">
<input type="checkbox" :id="item.id" :value="item.id" v-model="selectedIndex"/>
<label :for="item.id" class="choice-item">{{item.txt}}</label>
</li>
</ul>
</div>
</div>
</template> <script>
export default {
name: 'userFollow',
data() {
return {
selectedIndex: [],
followLists: [
{id: 0, txt: '入职体检'},
{id: 1, txt: '入职体检'},
{id: 2, txt: '入职体检'},
{id: 3, txt: '入职体检'},
{id: 4, txt: '入职体检'}
]
}
}
}
</script> <style scoped>
h4 {
font-size: 18px;
}
.follow {
padding: 30px 0 0 10px;
float: left;
width: 400px;
color: #0c0c0c;
}
.follow h4 {
color: #358ee7;
}
.follow p {
margin-bottom: 12px;
}
// 隐藏input
.follow ul li input {
display: none;
}
// 设置lable样式
.choice-item {
float: left;
width: 120px;
height: 36px;
line-height: 36px;
text-align: center;
border-left: 6px solid #d6d6d6;
background-color: #eaeaea;
margin-bottom: 16px;
margin-right: 10px;
cursor: pointer;
}
// 设置选中项label样式
input:checked + .choice-item {
color: #fff;
border-left: 6px solid #0a69c7;
background-color: #358ee7;
}
</style>

vue 实现多选的更多相关文章

  1. vue实现全选效果

    vue实现全选效果 接触vue快半年了,记得刚用vue做项目的时候遇到一个全选功能,当时到处百度也没有找到怎么实现,最后还是用了jquery进行dom操作实现的. 今天没事就顺手写了一个,感觉很简单, ...

  2. vue实现全选框效果

    vue实现全选框效果 一.总结 一句话总结: 全选的checkbox点击的时候判断这个checkbox的状态,如果没选中,说明下一个操作是选中所有 下面的每个checkbox判断一下是否所有的chec ...

  3. [原]vue实现全选,反选

    用vue写业务代码时候,后端大神丢给我一堆数据,要求是做全选,反选功能,然后把用户更改的数据全部返回给他 基本思路 如果父级选中了,那么父级下面的子集全部选中checked=true; 如果子集中选中 ...

  4. Vue实现勾选后向数组都添加

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. vue分页全选和单选操作

    <!DOCTYPE html> <html> <head> <title>演示Vue</title> <style> ul,li ...

  6. vue中全选和取消

    1.效果预览 2.index.html <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  7. vue实现全选,反选

    1.example.vue <template> <table class="table-common"> <tr> <th class= ...

  8. Angular/Vue多复选框勾选问题

    此页面效果以Angular实现,Vue也可按照其大致流程实现,其核心本质没有改变. 功能效果为:页面初始化效果为要有所有角色的复选框,要求初始化默认勾选的角色要显示勾选,之后,能按照最终勾选的状态提交 ...

  9. vue实现全选反选--简单使用

    最近需要用到vue的反选全选功能,于是就在网上找了一些代码实现,发现都不能够完美的实现.于是乎决定自己写出一套.经过一翻努力,完美了进行了实现.bug也已经修复完毕,希望能够帮助到大家!   < ...

  10. vue 项目 多选 问题

    近期 vue 项目用到多选功能,引用的elementUI的级联多选 Cascader,但是没有效果. 后来发现是elementUI版本问题,我们项目用的是2.7.2版本,版本太低. 后来 卸载了 重新 ...

随机推荐

  1. addEventListener 的事件冒泡

    语法 target.addEventListener(type, listener, useCapture); target 文档节点.document.window 或 XMLHttpRequest ...

  2. Others-阿里专家强琦:流式计算的系统设计和实现

    阿里专家强琦:流式计算的系统设计和实现 更多深度文章,请关注云计算频道:https://yq.aliyun.com/cloud 阿里云数据事业部强琦为大家带来题为“流式计算的系统设计与实现”的演讲,本 ...

  3. vue:图片切换动态显示

    <img :src="切换条件 ? require('xxx.png') : require('xxx.png')" />

  4. THE BOX MODEL

    Review In this lesson, we covered the four properties of the box model: height and width, padding, b ...

  5. keal

    I remember the wonderful moment you appeared before me, like a fleeting vision, like a genius of pur ...

  6. UE 不生成.bak文件

    .bak文件是UE处理文件时自动备份的文件,可以取消备份这样就不会生成.bak文件了 菜单:高级-设置-文件处理-备份        应用和确定

  7. JS 打印图片

    在使用window.print()进行打印时,打印的内容可能会包含图片内容,此时的图片内容不能设置为背景图片,否则将无法再打印页面显示. <!doctype html> <html& ...

  8. Delphi XE3通过ADOConnection 连接 MySQL 5.5.27 数据库

    Delphi XE3通过ADOConnection 连接 MySQL 5.5.27 数据库 unit Unit1; interface uses Winapi.Windows, Winapi.Mess ...

  9. ArcGIS案例学习笔记-查找重叠的多边形

    ArcGIS案例学习笔记-查找重叠的多边形 联系方式:谢老师,135-4855-4328,xiexiaokui@qq.com 目的:对于多边形图层,查找具有重叠(相互覆盖)的面 数据: 方法: 1. ...

  10. is not writable or has an invalid setter method错误的解决

    java中在配置spring时,遇到is not writable or has an invalid setter method的错误一般是命名方式的问题 需要写成private userInfoD ...