VUE登录注册页面,完整vue,直接复制
作者:小教学发布时间:2023-09-25分类:程序开发学习浏览:83
导读:效果图:Login.vue<template><divcla...
效果图:
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>
- 程序开发学习排行
-
- 1鸿蒙HarmonyOS:Web组件网页白屏检测
- 2HTTPS协议是安全传输,为啥还要再加密?
- 3HarmonyOS鸿蒙应用开发——数据持久化Preferences
- 4记解决MaterialButton背景颜色与设置值不同
- 5鸿蒙HarmonyOS实战-ArkUI组件(RelativeContainer)
- 6鸿蒙HarmonyOS实战-ArkUI组件(Stack)
- 7鸿蒙HarmonyOS实战-ArkUI组件(GridRow/GridCol)
- 8[Android][NDK][Cmake]一文搞懂Android项目中的Cmake
- 9鸿蒙HarmonyOS实战-ArkUI组件(mediaquery)
- 最近发表
-
- WooCommerce最好的WordPress常用插件下载博客插件模块的相关产品
- 羊驼机器人最好的WordPress常用插件下载博客插件模块
- IP信息记录器最好的WordPress常用插件下载博客插件模块
- Linkly for WooCommerce最好的WordPress常用插件下载博客插件模块
- 元素聚合器Forms最好的WordPress常用插件下载博客插件模块
- Promaker Chat 最好的WordPress通用插件下载 博客插件模块
- 自动更新发布日期最好的WordPress常用插件下载博客插件模块
- WordPress官方最好的获取回复WordPress常用插件下载博客插件模块
- Img to rss最好的wordpress常用插件下载博客插件模块
- WPMozo为Elementor最好的WordPress常用插件下载博客插件模块添加精简版