Vue + Element UI——对话框式登录框DEMO
源代码
<template><div class="login"><el-button type="success" class="loginButton" @click="centerDialogVisible = true" >Login</el-button><el-dialogtitle="系统登录":append-to-body="true":visible.sync="centerDialogVisible"width="320px"v-loading="loading"element-loading-text="正在登录..."element-loading-spinner="el-icon-loading"element-loading-background="rgba(0, 0, 0, 0.8)"center><el-form:rules="rules"ref="loginForm":model="loginForm"><el-form-item prop="username"><el-input size="normal" type="text" v-model="loginForm.username" auto-complete="off"placeholder="请输入用户名"></el-input></el-form-item><el-form-item prop="password"><el-input size="normal" type="password" v-model="loginForm.password" auto-complete="off"placeholder="请输入密码"></el-input></el-form-item><el-form-item prop="code"><el-input size="normal" type="text" v-model="loginForm.code" auto-complete="off"placeholder="点击图片更换验证码" @keydown.enter.native="submitLogin" style="width: 75%"></el-input><el-image :src="vcUrl" @click="updateVerifyCode" alt="" style="width: 25%;line-height: normal;overflow: visible"/></el-form-item><el-form-item class="loginRemember"><el-checkbox size="normal" v-model="checked">Remember me</el-checkbox></el-form-item><el-form-item class="loginSubmitButton"><el-button type="primary" @click="centerDialogVisible = false">取 消</el-button><el-button type="primary" @click="submitLogin">登录</el-button></el-form-item></el-form><span slot="footer" class="dialog-footer"><el-divider>其他登录方式</el-divider><el-button type="primary" icon="el-icon-edit" circle></el-button><el-button type="success" icon="el-icon-check" circle></el-button><el-button type="info" icon="el-icon-message" circle></el-button><el-button type="warning" icon="el-icon-star-off" circle></el-button><el-button type="danger" icon="el-icon-delete" circle></el-button></span></el-dialog></div>
</template><script>export default {name: "Login",data() {return {loading: false,vcUrl: '/verifyCode?time='+new Date(),loginForm: {username: 'admin',password: '123',code:''},checked: true,centerDialogVisible: false,rules: {username: [{required: true, message: '请输入用户名', trigger: 'blur'}],password: [{required: true, message: '请输入密码', trigger: 'blur'}],code: [{required: true, message: '请输入验证码', trigger: 'blur'}]}}},methods: {updateVerifyCode() {this.vcUrl = '/verifyCode?time='+new Date();},submitLogin() {this.loading = true;this.postKeyValueRequest('/doLogin', this.loginForm).then(resp => {this.loading = false;console.log(resp)})}}}
</script><style>.login{display: inline-block;}.loginButton{display: inline-block;}.loginRemember {text-align: left;margin: 0px 0px 15px 0px;}.loginSubmitButton{text-align: center;}
</style>
运行结果
参考项目
https://github.com/lenve/vhr
Vue + Element UI——对话框式登录框DEMO相关推荐
- Vue + Element UI 实现 登陆注册基本demo实例
Vue + Element UI 实现权限管理系统 前端篇(二):Vue + Element 案例 导入项目 打开 Visual Studio Code,File --> add Folder ...
- 【前端】Vue+Element UI案例:通用后台管理系统-用户管理:Table表格增删查改、Pagination分页、搜索框
文章目录 目标 代码 0.结构 1.按钮-删除 2.按钮-编辑 3.debug 4.样式 5.分页Pagination:功能 6.分页Pagination:样式 7.搜索框:功能 8.搜索框:样式 总 ...
- 【前端】Vue+Element UI案例:通用后台管理系统-用户管理:Form表单填写、Dialog对话框弹出
文章目录 目标 代码 0.页面结构 1.新增按钮和弹出表单:结构 2.新增按钮和弹出表单:点击新增弹出表单 3.表单样式 4.表单验证 5.表单的提交和取消功能:接口.mock相关准备 6.表单的提交 ...
- vue+element ui实现好看的登录界面
闲暇之余使用vue+element ui制作了个登录界面 话不多说,先上图 界面效果图 下面直接上代码: <template><div class="loginbody&q ...
- Vue实现Element UI的下拉框默认选中,值来自父组件或异步获取
子组件使用watch监听父组件传过来的值,并且赋值给子组件的data参数. 1.父组件传了一个userId属性给子组件 <Children@searchForm="searchForm ...
- 【前端】Vue+Element UI案例:通用后台管理系统-登陆不同用户显示不同菜单、动态添加路由
文章目录 目标 代码 0.动态地显示菜单:store 1.动态注册路由 2.解决刷新后摆平问题 总代码 本篇修改的代码文件 tab.js 参考视频: VUE项目,VUE项目实战,vue后台管理系统,前 ...
- 【前端】Vue+Element UI案例:通用后台管理系统-代码总结(已开源)
文章目录 前言 项目文件目录 api mockServe home.js permission.js index.js mock.js user.js assert components Common ...
- 基于vue(element ui) + ssm + shiro 的权限框架
zhcc 基于vue(element ui) + ssm + shiro 的权限框架 引言 心声 现在的Java世界,各种资源很丰富,不得不说,从分布式,服务化,orm,再到前端控制,权限等等玲琅满目 ...
- vue+element ui表单校验(邮箱、电话、工商信息)
vue+element ui表单校验(邮箱.电话.工商信息)) Html部分 <template><div><el-steps :active="active& ...
最新文章
- Windows7下硬盘安装RHEL 6.1
- 主流语言实现冒泡排序算法
- JS-以鼠标位置为中心的滑轮放大功能demo1
- 华为服务器gpu卡型号,gpu服务器与配置
- SAP License:SAP Business One系统功能
- LaTeX的历史:图灵奖得主1977年开启的计划,引发学术圈重大变革
- 目标检测(一):背景差分法
- shopnum1商城系统
- 基于XML的ASP留言板
- 使用FastReport报表工具生成标签打印文档
- debian nvidia 安装_Debian安装Nvidia显卡驱动
- spring boot oauth2 facebook
- java创建pdf空白页_使用itext将html转成PDF,PDF空白的问题。
- 极致Review,阿里绩效管理的核心工具
- Java练习之复数运算
- google 浏览器打印不出颜色问题
- 测试通达信指标胜率的软件,如何测试通达信指标成功率?
- 复杂美区块链案例介绍
- 微星武士 76 评测
- android 学习运用海马模拟器教程与android环境的搭建
热门文章
- 关于我喜欢计算机的作文600字,关于我喜欢的字作文600字5篇
- ubuntu安装python库_Ubuntu18.04一次性升级Python所有库的方法步骤
- 不安全的发布 java_如何在没有安全警告的情况下发布Java Web S...
- python全局变量在程序执行的全过程有效_PYTHON使每个过程都可以访问全局变量
- 我的世界梦之边缘5服务器在维护吗,8月5日服务器例行维护公告(已完成)
- python for loop循环程序语句_python-带for循环的格式化输出_for-loop_酷徒编程知识库...
- 二十四、爬取古诗网中的100首古诗文
- 深度学习篇| keras入门(一)
- 四十二、Scrapy爬取csdn的博客标题和网址
- tensorflow从入门到放弃(一)