vue切换登录方式

时间:2020-03-08 16:34:43   收藏:0   阅读:193
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./../vue.min.js"></script>
</head>
<body>
  <div id="app">
  <span v-if="isUser"><lable for="userName">用户账号:</lable><input type="text" id="userName" placeholder="用户账号"></span>
  <span v-else><label for="userEmail">用户邮箱:<input type="email" id="userEmail"  placeholder="用户邮箱"></label></span>
  <button @click="switchButton">切换类型</button>
  </div>
  <script>
  const app=new Vue({
    el:"#app",
    data:{
    isUser:true
    },
    methods:{
      switchButton(){
        return this.isUser=!this.isUser
      }
    }
  })
  </script>
</body>
</html>

技术分享图片

 

原文:https://www.cnblogs.com/wxy0715/p/12442486.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!