用bootstrap框架后台登陆生成vue2格式template这种的代码无需任何文字说明只要源码即可
<template>
<div class="login">
<form class="login-form">
<h2 class="form-title">Login</h2>
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" class="form-control" v-model="username" placeholder="Enter your username">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" class="form-control" v-model="password" placeholder="Enter your password">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-block" @click.prevent="login">Login</button>
</div>
</form>
</div>
</template>
<script>
export default {
data() {
return {
username: '',
password: ''
}
},
methods: {
login() {
// call login API with this.username and this.password
}
}
}
</script>
<style scoped>
.login {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.login-form {
width: 400px;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
.form-title {
margin-top: 0;
margin-bottom: 20px;
text-align: center;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
}
input[type=text], input[type=password] {
width: 100%;
padding: 10px;
font-size: 16px;
border-radius: 5px;
border: 1px solid #ccc;
}
button[type=submit] {
font-size: 16px;
border-radius: 5px;
padding: 10px;
}
</style>
原文地址: https://www.cveoy.top/t/topic/bh7n 著作权归作者所有。请勿转载和采集!