登錄注冊頁面


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
   <link rel="stylesheet" href="./css/bootstrap.min.css" >
   <style>
      .register-box{
         width: 540px;
         margin: auto;
      }
      .center{
         text-align: center;
      }
   </style>
   <title>注冊</title>
</head>
<body>
   <div id="app">
      <div class="register-box">
         <div class="center">
            <h1>注冊</h1>
         </div>

         <m-input v-model="username" validate :warn="warn.username" label="用戶名" warnmessage="用戶名不能為空!"></m-input>
         <m-input v-model="password" type="password" validate :warn="warn.password" label="密 碼" warnmessage="密碼不能為空!"></m-input>
         <m-input v-model="rePassword" type="password" validate :warn="warn.rePassword" label="重復密碼" warnmessage="重復密碼和密碼不同!"></m-input>

         
         
            <div class="center">
                  <button type="button" class="btn btn-primary" @click="register">注冊</button>
                  <button type="button" class="btn btn-default" @click="back">返回</button>
            </div>
      </div>
   </div>

</body>
<script type="text/javascript" src="./script/vue.js"></script>
<script type="text/javascript" src="./script/components/form.js"></script>
<script>
   var app = new Vue({
      el:'#app',
      data:{
         username:'',
         password:'',
         rePassword:'',
         warn:{
               username:false,
               password:false,
               rePassword:false  }
         
      },
      
      watch:{
         username:function(value){
            if (value===''|| value===null) {
               this.warn.username=true  }else{
               this.warn.username=false  }
         },
         password:function(value){
            this.warn.password=value===''||value===null  },
         rePassword:function(value){
            this.warn.rePassword=value!==this.password
         }
      },
      methods:{
         register:function(){
            console.log("register")
            console.log(this.username)
            console.log(this.password)
            console.log(this.rePassword)
            window.location.href='./login.html'
            
         },
      
         back:function(){
            console.log("back")
            window.location.href='./login.html'
         }
      }
   })
</script>
</html>
<<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
   <title>登錄</title>
   <link rel="stylesheet" href="./css/bootstrap.min.css" >
</head>
<body>
   <div id="app">
      <m-center-box>
         <m-center>
            <h1>登錄</h1>
         </m-center>
         <form>
            <m-input :labelwidth="90" v-model="username" label="用戶名"></m-input>
               <m-input :labelwidth="90" type="password" v-model="password" label="密 碼"></m-input>
            <m-center>
               <button type="button" class="btn btn-primary" @click="login">登錄</button>
               <button type="button" class="btn btn-default" v-on:click="register">注冊</button>
            </m-center>
         </form>
      </m-center-box>
   </div>

</body>
<script type="text/javascript" src="./script/vue.js"></script>
<script type="text/javascript" src="./script/components/form.js"></script>
<script>
   var app = new Vue({
      el:'#app',
      data:{
         username:'',
         password:''
      },
      methods:{
         login:function(){
            console.log("login")
            console.log(this.username)
            console.log(this.password)
            // window.location.href='./home.html'
         },
         register:function(){
            console.log("register")
            window.location.href='./register.html'
         }
      }
   })
</script>
</html>


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
  © 2014-2022 ITdaan.com 联系我们: