function notify(msg, type = 'error') {
const Toast = Swal.mixin({
toast: true,
width: 300,
position: 'top',
showConfirmButton: false,
timer: 1000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
Toast.fire({
icon: type,
title: msg
})
}
const http = axios.create({
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')}
});
//找到登录表单
const loginFrom = document.querySelector('.login-form');
loginFrom && loginFrom.addEventListener('submit', function (e) {
e.preventDefault()
//找到值
let name = document.getElementById('name');
let password = document.getElementById('password');
let captcha = document.getElementById('captcha');
//表单验证
//...
//获取请求的地址
http({
method: 'post',
url: loginFrom.getAttribute('action'),
data: {
name: name.value,
password: password.value,
captcha: captcha.value,
}
}).then(({
data}) =
laravel开发中公共的css
最新推荐文章于 2021-07-01 10:33:44 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)