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>

由于显示的分辨率和比例不同,最终展示可能出现位置不对等问题,主要调节<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登录注册页面内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

相关文章

  • vue input 输入校验字母数字组合且长度小于30的实现代码

    vue input 输入校验字母数字组合且长度小于30的实现代码

    这篇文章主要介绍了vue input 校验字母数字组合且长度小于30的实现代码,文章给大家补充介绍了在Vue.Js下使用el-input框只能输入数字并限制位数并且限制中文输入以及粘贴功能,感兴趣的朋友跟随脚本之家小编一起看看吧
    2018-05-05
  • vue2 全局变量的设置方法

    vue2 全局变量的设置方法

    下面小编就为大家分享一篇vue2 全局变量的设置方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
    2018-03-03
  • vue3响应式原理之Ref用法及说明

    vue3响应式原理之Ref用法及说明

    这篇文章主要介绍了vue3响应式原理之Ref用法及说明,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-12-12
  • Vue中使用vue-count-to(数字滚动插件)详细教程

    Vue中使用vue-count-to(数字滚动插件)详细教程

    这篇文章主要给大家介绍了关于Vue中使用vue-count-to(数字滚动插件)的相关资料,最近需要开发一个数字滚动效果,在网上找到一个关于vue-countTo的插件,觉得这个插件还不错,需要的朋友可以参考下
    2023-09-09
  • Vue ElementUI中Upload组件批量上传的实现代码

    Vue ElementUI中Upload组件批量上传的实现代码

    ElementUI中Upload组件批量上传通过获取upload组件的DOM、文件、上传地址和数据,封装uploadFiles方法,使用ajax方式上传多个文件,后台接口接收多文件并返回上传结果,本文介绍Vue ElementUI中Upload组件如何批量上传,感兴趣的朋友一起看看吧
    2025-02-02
  • vite+vue3项目集成ESLint与prettier的过程详解

    vite+vue3项目集成ESLint与prettier的过程详解

    这篇文章主要介绍了vite+vue3项目中集成ESLint与prettier的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2023-09-09
  • Vite打包项目后图片丢失的简单解决方法

    Vite打包项目后图片丢失的简单解决方法

    vue项目完成打包上线的时候很多人都会碰到静态资源找不到的情况,下面这篇文章主要给大家介绍了关于Vite打包项目后图片丢失的简单解决方法,需要的朋友可以参考下
    2023-05-05
  • vue中使用vee-validator完成表单校验方案

    vue中使用vee-validator完成表单校验方案

    vee-validator是一种基于vue模板的轻量级校验框架。本文主要讨论的是vee-validator校验方案,感兴趣的朋友跟随小编一起看看吧
    2019-11-11
  • vue实现纯前端表格滚动分页加载

    vue实现纯前端表格滚动分页加载

    这篇文章主要为大家详细介绍了vue实现纯前端表格滚动分页加载,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
    2022-04-04
  • vue实现移动端table表格简单方法

    vue实现移动端table表格简单方法

    这篇文章主要给大家介绍了关于vue实现移动端table表格简单方法的相关资料,使用Vue.js开发移动应用程序时,经常需要使用各种UI组件,其中el-table是一个常用的表格组件,可以方便地展示数据,需要的朋友可以参考下
    2023-09-09

最新评论