登录界面
基于vue-router实现
演示界面 https://zpliu1126.github.io/LearnJs/html/login.html
首先router中定义好了路由
const router = new VueRouter({
routes: [{ path: "/", redirect: "/home" },
{ path: '/home', component: home, },
{ path: '/register', component: register },
{ path: '/home/news', component: news },
{ path: '/blog', component: blog },
{ path: '/login', component: login },
]
})
export default router使用
blog.vue组件作为首页在blog.vue组件中放置路由出口,当路由发生改变时转变页面
<div class="blog-container"> <router-view></router-view> </div>当路由中使用到
/login/时,将会在路由出口进行渲染登录组件
login.vue<div id="loginContainer"> <div class="card"> <div class="card-header"> Weclome To Github </div> <div class="card-body"> <form action="#"> <div class="form-group"> <label for=""> Account </label> <input type="text" class="form-control" required placeholder="Tel phone number or email"> </div> <div class="form-group"> <label for=""> password </label> <input type="password" class="form-control" required placeholder="At least five character"> </div> <button class="form-control btn" type="submit" style="">login</button> </form> </div> </div> </div> </div>接下来就是交给css和js的活了
用到了flex弹性布局
flex-direction 垂直方向布局
align-items 交叉轴方向,居中
justify-content 主轴方向居中
vue中进行密码的验证
Last updated
Was this helpful?