vue实现底部弹窗多选
更新时间:2021年9月5日 16:00 点击:2492
本文实例为大家分享了vue实现底部弹窗多选的具体代码,供大家参考,具体内容如下
代码:
<template> <div class="release-post"> <div class="resume_main"> <div class="resume_content"> <van-form> <div class="table_list post_welfare"> <p class="name_title">岗位福利<span class="required">*</span></p> <van-field class="calendar" input-align="left" v-model="benefits" placeholder="请选择岗位福利" @focus="onFocus" :class="{ borderStyle: welfareChange }" @click.stop="clickWelfare" :disabled="true" /> </div> </van-form> <!-- 岗位福利 --> <van-popup v-model="showWelfare" position="bottom"> <div class="welfare_top"> <p></p> <p class="welfare_title">福利待遇(可多选)</p> <p class="welfare_btn" @click.stop="onConfirmSpeed">完成</p> </div> <div class="welfare_content"> <div v-for="(item, index) in welfareList" :key="index" :class="{ active: item.active }" id="welfare_item" @click.stop="clickWelfareItem(item, index)" > <p :class="item.active ? 'welfare_text' : 'not_welfare_text'"> {{ item.text }} </p> </div> </div> </van-popup> </div> </div> <div> <div class="mask"> <button class="btn" @click="submit" :class="{ btnBg: colorChange() }" v-preventReClick="1000" > 完成 </button> </div> </div> </div> </template> <script> import Vue from 'vue'; import { Circle, DatetimePicker, Form, Field, Toast, Calendar, Picker, Overlay, ActionSheet, Popup } from 'vant'; import 'vant/lib/index.less'; Vue.use(Circle).use(DatetimePicker).use(Form).use(Field).use(Toast).use(Calendar).use(Picker).use(Overlay).use(ActionSheet).use(Popup); export default { name: "PerfectPost", data () { return { welfareList: [ { id: 1, text: "包吃" }, { id: 2, text: "包住" }, { id: 3, text: "五险一金" }, { id: 4, text: "年底双薪" }, { id: 5, text: "商业险" }, { id: 6, text: "意外险" }, { id: 7, text: "团建" }, { id: 8, text: "周末双休" }, { id: 9, text: "下午茶" }, { id: 10, text: "餐补" }, { id: 11, text: "交通补助" }, { id: 12, text: "班车接送" }, { id: 13, text: "奖金" }, { id: 14, text: "公费培训" }, { id: 15, text: "公费旅游" }, ], showWelfare: false,//岗位福利 onlineForm: { benefits: "",//岗位福利 }, checkedList: [], welfareChange: false, }; }, methods: { //弹出岗位福利 clickWelfare () { this.showRedTips() this.showWelfare = true }, //选择福利项 clickWelfareItem (v) { if (v.active) { Vue.set(v, 'active', false) } else if (this.checkedList.length < 5) { Vue.set(v, 'active', true) } this.checkedList = this.welfareList.filter(function (item) { return item.active }) if (this.checkedList.length >= 5) { Toast('最多只能选择5个哦') } }, //完成福利选项 onConfirmSpeed () { this.showWelfare = false this.welfareChange = false let itemList = this.checkedList.map((item) => { return item.text }); let str = itemList.join('/') let str1 = itemList.join(';') this.benefits = str ? str : this.benefits this.onlineForm.benefits = str1 ? str1 : this.benefits }, showRedTips () { this.welfareChange = false }, onFocus () { this.showRedTips() }, //下一步按钮色值 colorChange () { if (this.onlineForm.benefits) { return true } }, // 验证 validateOnlineForm () { let valid = true; if (!this.onlineForm.benefits || !this.onlineForm.benefits.trim()) { valid = false; Toast('请选择岗位福利') this.welfareChange = true } return valid; }, //提交 submit () { if (this.validateOnlineForm()) { Toast('提交') } }, }, }; </script> <style scoped lang="less" > * { margin: 0; padding: 0; } ::v-deep .van-picker__title { font-size: 17px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; text-align: center; color: #333333; } .release-post { width: 100%; padding-bottom: 64px; padding-top: constant(safe-area-inset-top); padding-top: env(safe-area-inset-top); } .post_welfare { ::v-deep .van-field__control:disabled { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #333333; -webkit-text-fill-color: #333333; } ::v-deep input::-webkit-input-placeholder { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #999999; -webkit-text-fill-color: #999999; } } ::v-deep .van-field__control:disabled { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #333333; -webkit-text-fill-color: #333333; } .welfare_content { padding-top: 10px; padding-bottom: 30px; display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; margin: 0 16px; } #welfare_item { width: 31%; } .welfare_top { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: solid 0.5px #e5e5e5; } .welfare_title { font-size: 17px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; text-align: center; color: #333333; margin-right: -16px; } .welfare_btn { font-size: 16px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: right; color: #333333; margin-right: 16px; } .welfare_text { height: 36px; background: #f4f8ff; border: 1px solid #bbdcff; border-radius: 4px; margin-top: 10px; line-height: 36px; font-size: 14px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; text-align: center; color: #1283ff; } .not_welfare_text { height: 36px; background: #ffffff; border: 1px solid #e5e5e5; border-radius: 4px; margin-top: 10px; line-height: 36px; font-size: 14px; font-family: PingFang, PingFang-SC; font-weight: 500; text-align: center; color: #333333; } .resume_content { margin-left: 30px; margin-right: 30px; ::v-deep { .van-popup--bottom { border-top-left-radius: 12px; border-top-right-radius: 12px; } } } .mask { width: 100%; background: #ffffff; box-shadow: 0px 0px 8px 0px rgba(204, 204, 204, 0.3); position: fixed; bottom: 0; left: 0; display: flex; justify-content: center; align-items: center; padding: 10px 0; padding-bottom: calc(env(safe-area-inset-bottom)+15px); padding-bottom: calc(env(safe-area-inset-bottom) + 15px); } .btn { font-size: 16px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; text-align: left; color: #ffffff; margin: 0 auto; text-align: center; line-height: 1.6rem; width: 100%; margin: 0 16px; height: 48px; background: #d8d8d8; } .btnBg { font-size: 16px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; text-align: left; color: #ffffff; margin: 0 auto; text-align: center; line-height: 1.6rem; width: 100%; margin: 0 16px; height: 48px; background: #d8d8d8; border: none; outline: none; background: linear-gradient(90deg, #50a3ff, #1283ff); border-radius: 4px; } .name_title { font-size: 16px; font-family: PingFangSC, PingFangSC-Medium; font-weight: 500; color: #333333; } .required { font-size: 13px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; color: #ff1d28; position: absolute; } .calendar { width: 100%; height: 49px; background: #ffffff; border: 1px solid #e5e5e5; border-radius: 5px; margin-top: 10px; padding-left: 20px; background: url("./images/drop-down.png") no-repeat 96% center; background-size: 10px 7px; padding-right: 25px; ::v-deep .van-field__control { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #333333; margin-top: 12px; } } ::v-deep input::-webkit-input-placeholder { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #afadad; -webkit-text-fill-color: #afadad; } .table_list { margin-top: 16px; } .borderStyle { border: solid 1px #ff1d28; border-radius: 3px; } input::-webkit-input-placeholder { font-size: 15px; font-family: PingFangSC, PingFangSC-Regular; font-weight: 400; text-align: left; color: #999999; } .van-field__control { color: #333333; } </style>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持猪先飞。
上一篇: vue实现内容可滚动的弹窗效果
下一篇: vue+echart实现双柱状图
相关文章
- 这篇文章主要介绍了vue中activated的用法,帮助大家更好的理解和使用vue框架,感兴趣的朋友可以了解下...2021-01-03
基于vue-simple-uploader封装文件分片上传、秒传及断点续传的全局上传插件功能
这篇文章主要介绍了基于vue-simple-uploader封装文件分片上传、秒传及断点续传的全局上传插件,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-02-23Antd-vue Table组件添加Click事件,实现点击某行数据教程
这篇文章主要介绍了Antd-vue Table组件添加Click事件,实现点击某行数据教程,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-11-17- 这篇文章主要介绍了Vue基于localStorage存储信息代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下...2020-11-16
- 这篇文章主要介绍了vue 实现动态路由的方法,文中示例代码非常详细,帮助大家更好的理解和学习,感兴趣的朋友可以了解下...2020-07-06
- 这篇文章主要介绍了vue 监听 Treeselect 选择项的改变操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-09-01
- 这篇文章主要介绍了Vue组件跨层级获取组件操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-07-28
- 这篇文章主要介绍了vue 获取到数据但却渲染不到页面上的解决方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2020-11-19
antdesign-vue结合sortablejs实现两个table相互拖拽排序功能
这篇文章主要介绍了antdesign-vue结合sortablejs实现两个table相互拖拽排序功能,本文通过实例图文相结合给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-01-09vuejs element table 表格添加行,修改,单独删除行,批量删除行操作
这篇文章主要介绍了vuejs element table 表格添加行,修改,单独删除行,批量删除行操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-07-18- 这篇文章主要给大家介绍了关于Vue中slot-scope的深入理解,这个教程非常适合初学者,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-04-17
- 最常见的多环境配置,就是开发环境配置,和生产环境配置,本文主要介绍了vue项目多环境配置的实现,感兴趣的可以了解一下...2021-07-20
- 这篇文章主要介绍了vue treeselect获取当前选中项的label实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-09-01
vue项目页面嵌入代码块vue-prism-editor的实现
这篇文章主要介绍了vue项目页面嵌入代码块vue-prism-editor的实现,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-10-30- 这篇文章主要介绍了Vue 3.0 中 jsx 语法使用,帮助大家更好的理解和使用vue框架,感兴趣的朋友可以了解下...2020-11-13
vue Treeselect下拉树只能选择第N级元素实现代码
这篇文章主要介绍了vue Treeselect下拉树只能选择第N级元素实现代码,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-09-01解决vue的router组件component在import时不能使用变量问题
这篇文章主要介绍了解决vue的router组件component在import时不能使用变量问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-07-27Ant design vue table 单击行选中 勾选checkbox教程
这篇文章主要介绍了Ant design vue table 单击行选中 勾选checkbox教程,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-10-25- 这篇文章主要为大家详细介绍了vue实现同时设置多个倒计时,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-05-20
- 这篇文章主要介绍了WebStorm无法正确识别Vue3组合式API的解决方案,帮助大家更好的理解和学习使用vue框架,感兴趣的朋友可以了解下...2021-02-18