本文实例为大家分享了vue实现登录类型切换的具体代码,供大家参考,具体内容如下
运行效果

代码
?<!DOCTYPE html> < html lang = "en" > < head > < meta charset = "UTF-8" > < title >登录类型切换</ title > < script src = "../js/vuejs-2.5.16.js" ></ script > </ head > < body > < div id = "app" > < span v-if = "isUser" > < label for = "userAccount" >用户账户:</ label > < input type = "text" id = "userAccount" placeholder = "请输入账户" key = "userAccount" > </ span > < span v-else> < label for = "userEmail" >用户邮箱:</ label > < input type = "text" id = "userEmail" placeholder = "请输入邮箱" key = "userEmail" > </ span > < button @ click = "changeType" >切换类型</ button > </ div > </ body > < script > const app = new Vue({ el: '#app', data: { isUser: true }, methods:{ changeType(){ return this.isUser = ! this.isUser } } }) </ script > </ html > |
代码片段解析

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理