Home > Back-end >  How to realize the jump and cancellation function duck
How to realize the jump and cancellation function duck

Time:11-03

Please write the full code for an android login page (including resources, interface (design), event), requirements: click "login" button, if the user name and password is "admin" and "123456" respectively, jump to the welcome screen; When you click "cancel" function of empty

CodePudding user response:




<script>
The import axios from 'axios'
Export the default {
Data () {
Return {
User: {

},

}
},
Mounted () {

},
Methods: {
Loginuser () {
Var url=` ` http://localhost:8080/user
Axios. Post (url, enclosing the user)
. Then ((response)=& gt; {
If (confirm (" do you want to log in?" ) & amp; & Response. Data. Code==1) {

Alert (response) data) message)
This $router. Push ('/newsList ')
} else {
Alert (response) data) message)
Return
}



})
The catch ((error)=& gt; {
Alert (" fail ")
})
},



},
}
</script>

CodePudding user response:

reference 1 floor integration involved problems.the zhuolu apes response:



<script>
The import axios from 'axios'
Export the default {
Data () {
Return {
User: {

},

}
},
Mounted () {

},
Methods: {
Loginuser () {
Var url=` ` http://localhost:8080/user
Axios. Post (url, enclosing the user)
. Then ((response)=& gt; {
If (confirm (" do you want to log in?" ) & amp; & Response. Data. Code==1) {

Alert (response) data) message)
This $router. Push ('/newsList ')
} else {
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related