How to display the alert of Vue.js

the front end uses axios to send it to the back end, makes a decision, and returns the data to the front end. But alert cannot be used in axios. How to solve this problem? The
code is as follows:

axios.post("/router", formData
          ,config
        ).then(rst =>{
          if(rst.status==0){
            alert("wrong");
          }else{
            this.Show = true;
          }
          console.log(rst.data);
        })

how to return to the front end and provide alert after the back-end check. The alert in this is completely useless.

Mar.10,2021

if you print out the res.status, there should be no problem with alert.


try this
this.$alert (text, 'hint', {

).
    confirmButtonText: '',
    callback: action => {
        
    }

});


using window.alert (), directly will not fail at any time.


 if(rst.status!=200){
    alert('wrong');
  }else{
    this.Show = true;
  }

if you want to judge the status value returned by the backend, you should add a layer of rst.data.status

The

alert method is good, but it needs a pop-up window, which is not good for debugging.
it is recommended that the title owner use debugger with console.log to print the content you want to display directly to the console.
compared with alert, console.log is not only convenient, but also does not block threads from running.
there are other methods similar to console.log:
console.error to output error messages
console.warn to output warning messages
console.info to output informational information
console.debug to output debugging information

either of these methods is better than alert.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaa8ef-47dbb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaa8ef-47dbb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?