Article directory
Introduction
The vue-router routing dependency has been installed by default, and
the src/router/index.js and src/views/login.vue components have been written
js script
Add such js in the src/views/login.vue component
import useRouter from "vue-router"
// 登录函数,点击登录触发
const login = () => {
// 表单校验
// 登录请求
// 登录如果成功的提示
// 异步请求,登录成功后的跳转,1.5s 后跳转
setTimeout(() => {
router.push("/home")
}, 1500)
// cookies 处理
}