Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

请教个问题,无法登录 #1

Open
lh333sunshine opened this issue Oct 11, 2020 · 4 comments
Open

请教个问题,无法登录 #1

lh333sunshine opened this issue Oct 11, 2020 · 4 comments

Comments

@lh333sunshine
Copy link

Login/index.vue

function handleSubmit() {
if (isTrimAction(userName.value) && isTrimAction(pwd.value)) {
let user = {userName:userName.value,pwd:pwd.value,time:new Date()}
localStorage.setItem('user',JSON.stringify(user))
state.store.commit('userFun',user)
this.$router.push({
path:'/layout'
})
return;
} else {
alert('请输账号密码')
}
}

其中 this.$router 为 undefine,跳转时报错

@loenvom
Copy link

loenvom commented Apr 6, 2021

一样的问题,作者可以解释一下吗,新手不太明白啊

@isooc
Copy link

isooc commented May 14, 2021

setup里面不能用this

@supbose
Copy link

supbose commented Sep 1, 2021

Login/index.vue

function handleSubmit() {
if (isTrimAction(userName.value) && isTrimAction(pwd.value)) {
let user = {userName:userName.value,pwd:pwd.value,time:new Date()}
localStorage.setItem('user',JSON.stringify(user))
state.store.commit('userFun',user)
this.$router.push({
path:'/layout'
})
return;
} else {
alert('请输账号密码')
}
}

其中 this.$router 为 undefine,跳转时报错

添加
import router from '@/router/index.js'


使用
router.push({path:'/layout'})

就OK了

@HakunamatataLeo
Copy link

根本无法登陆 账号密码都是admin么
@supbose

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants