VUE登錄注冊頁面完整代碼(直接復制)
更新時間:2023年12月25日 08:27:42 作者:good_good_study5
這篇文章主要給大家介紹了關于VUE登錄注冊頁面的相關資料,在Vue中可以使用組件來構建登錄注冊頁面,文中通過圖文以及代碼介紹的非常詳細,需要的朋友可以參考下
效果圖:
Login.vue
<template> <div class="container"> <div class="login-wrapper"> <div class="header">Login</div> <div class="form-wrapper"> <input type="text" name="username" placeholder="username" class="input-item"> <input type="password" name="password" placeholder="password" class="input-item"> <div class="btn">Login</div> </div> </div> </div> </template> <script> export default { name:"Login" } </script> <style scoped> html { height: 100%; } body { height: 100%; } .container { /* margin-top: 5%; */ height: 980px; width: 100%; background-image: linear-gradient(to right, #fbc2eb, #a6c1ee); } .login-wrapper { background-color: #fff; width: 358px; height: 588px; border-radius: 15px; padding: 0 50px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .header { font-size: 38px; font-weight: bold; text-align: center; line-height: 200px; } .input-item { display: block; width: 100%; margin-bottom: 20px; border: 0; padding: 10px; border-bottom: 1px solid rgb(128, 125, 125); font-size: 15px; outline: none; } .input-item:placeholder { text-transform: uppercase; } .btn { text-align: center; padding: 10px; margin: 0 auto; width: 100%; margin-top: 40px; background-image: linear-gradient(to right, #a6c1ee, #fbc2eb); color: #fff; } .msg { text-align: center; line-height: 88px; } a { text-decoration-line: none; color: #abc1ee; } </style>
Register.vue
<template> <div class="container"> <div class="login-wrapper"> <div class="header">Register</div> <div class="form-wrapper"> <input type="text" name="username" placeholder="賬戶" class="input-item"> <input type="password" name="password" placeholder="密碼" class="input-item"> <input type="password" name="repassword" placeholder="再次確認密碼" class="input-item"> <div class="btn">Register</div> </div> </div> </div> </template> <script> export default { name:"Reg" } </script> <style scoped> html { height: 100%; } body { height: 100%; } .container { /* margin-top: 5%; */ height: 980px; width: 100%; background-image: linear-gradient(to right, #fbc2eb, #a6c1ee); } .login-wrapper { background-color: #fff; width: 358px; height: 588px; border-radius: 15px; padding: 0 50px; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .header { font-size: 38px; font-weight: bold; text-align: center; line-height: 200px; } .input-item { display: block; width: 100%; margin-bottom: 20px; border: 0; padding: 10px; border-bottom: 1px solid rgb(128, 125, 125); font-size: 15px; outline: none; } .input-item:placeholder { text-transform: uppercase; } .btn { text-align: center; padding: 10px; width: 100%; margin-top: 40px; background-image: linear-gradient(to right, #a6c1ee, #fbc2eb); color: #fff; margin: 0 auto; } .msg { text-align: center; line-height: 88px; } a { text-decoration-line: none; color: #abc1ee; } </style>
由于顯示的分辨率和比例不同,最終展示可能出現位置不對等問題,主要調節(jié)<style>中.container的height屬性和.login-wrapper的transform:屬性
App.vue也奉上:
<template> <div id="app"> <div class="title"> <div class="btn" @click="msg='Login'">登錄</div> <div class="btn" @click="msg='Reg'">注冊</div> </div> <component :is="msg"></component> </div> </template> <script> //這里的from路徑根據自己的布局更改路徑 import Login from './components/login.vue' import Reg from './components/register.vue' export default { name: 'App', data(){ return{ msg:"Login" } }, components: { Login, Reg } } </script> <style> .title{ text-align: center; background-image: linear-gradient(to right, #fbc2eb, #a6c1ee); } .btn { background-color: rgb(210,193,326); border-radius:28px; border:1px solid #ffffff; display:inline-block; cursor:pointer; color:#ffffff; font-family:Arial; font-size:17px; padding:16px 31px; text-decoration:none; text-shadow:0px 1px 0px #2f6627; margin: 10px 20px; } .btn:hover { background-color:rgb(180,193,237); } .btn:active { position:relative; top:1px; } </style>
總結
到此這篇關于VUE登錄注冊頁面的文章就介紹到這了,更多相關VUE登錄注冊頁面內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
vue input 輸入校驗字母數字組合且長度小于30的實現代碼
這篇文章主要介紹了vue input 校驗字母數字組合且長度小于30的實現代碼,文章給大家補充介紹了在Vue.Js下使用el-input框只能輸入數字并限制位數并且限制中文輸入以及粘貼功能,感興趣的朋友跟隨腳本之家小編一起看看吧2018-05-05Vue中使用vue-count-to(數字滾動插件)詳細教程
這篇文章主要給大家介紹了關于Vue中使用vue-count-to(數字滾動插件)的相關資料,最近需要開發(fā)一個數字滾動效果,在網上找到一個關于vue-countTo的插件,覺得這個插件還不錯,需要的朋友可以參考下2023-09-09Vue ElementUI中Upload組件批量上傳的實現代碼
ElementUI中Upload組件批量上傳通過獲取upload組件的DOM、文件、上傳地址和數據,封裝uploadFiles方法,使用ajax方式上傳多個文件,后臺接口接收多文件并返回上傳結果,本文介紹Vue ElementUI中Upload組件如何批量上傳,感興趣的朋友一起看看吧2025-02-02vite+vue3項目集成ESLint與prettier的過程詳解
這篇文章主要介紹了vite+vue3項目中集成ESLint與prettier的相關知識,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-09-09