login() {
this.$refs.loginFormRef.validate(valid => {
if (valid) {
this.$axios.post('/admin/login', {
username: this.loginForm.username,
password: this.loginForm.password
}).then((response) => {
if (response.code === 200) {
this.$router.push({path: '/success'})
}
}).catch(() => {
console.log("用户名或密码错误!");
});
} else {
console.log("参数验证不合法!");
return false;
}
这一段改成什么样才可以在vue3里用啊 头疼几天了
我看了一下vue3依然可以使用$refs https://v3.cn.vuejs.org/api/instance-properties.html#refs
参考这个试试 https://blog.csdn.net/qq_42539194/article/details/116994776