后台管理系统-------登录功能实现(element-ui)
登录页面代码(login):
<template>
<div class="login">
<el-form
:model="userinfo"
:rules="loginRules"
label-position="right"
class="el_box"
label-width="60px"
>
<el-form-item label="账号:" class="el_username" prop="username">
<el-input v-model="userinfo.username"></el-input>
</el-form-item>
<el-form-item label="密码:" class="el_password" prop="username">
<el-input type="password" v-model="userinfo.password"></el-input>
</el-form-item>
<el-button type="primary" class="el_login" @click.prevent="login">登录</el-button>
</el-form>
</div>
</template>
<script>
import {
login } from "../http/api";
export default {
name: "login",
data() {
return {
userinfo: {
username: "",
password: ""
},
loginRules: {
username: [
{
required