vue前端登陆页面

npm组件安装

npm i element-ui -S

快速上手引入main.jsp

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui';  //
import 'element-ui/lib/theme-chalk/index.css';//

Vue.config.productionTip = false
Vue.use(ElementUI); //

Login.vue

<template>
    <div style="display: flex;justify-content: center">
        <el-card class="box-card" style="width:400px;margin-top: 100px">
            <div slot="header" class="clearfix">
                <span>登陆</span>
            </div>
            <div>
                 <table>
                <tr>
                    <td>用户名</td>
                 <td>
                     <el-input v-model="user.username" placeholder="请输入内容"></el-input>
                 </td>
                </tr>

                <tr>
                    <td>密码</td>
                <td><el-input placeholder="请输入密码" v-model="user.password" show-password
                              @keydown.enter.native="   doLogin"></el-input>
                </td>
             </tr>

                 <tr>
                <td colspan="2">
                    <el-button type="primary" round style="width: 280px;" @click="doLogin" >登陆</el-button>
                </td>
                    </tr>
                </table>
            </div>
        </el-card>
    </div>
</template>

<script>
    export default {
        name: "Login ",
        data(){
            return{
                user:{
                    username:``,
                    password:``
                }
            }
        },
        methods:{
            doLogin(){
                console.log(this.user);
            }
        }
    }
</script>

<style scoped>

</style>

index.js路由表注册组件

import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'

Vue.use(VueRouter)


const routes = [
  {
    path: '/',
    name: 'login',
    component: Login,
  }

]

const router = new VueRouter({
  routes
})

export default router

App.vue

<template>
  <div id="app">
    <router-view/>
  </div>
</template>

http://localhost:8080/#/
vue前端登陆页面_第1张图片
包括所有的组件

你可能感兴趣的:(Java项目)