[Three types of pop-up windows on the front end]

1. alert pop-up window

Only the "Confirm" button can be operated in the window

this.$alert(
      "提示信息",
      "提示",
      {
    
    
        confirmButtonText: "确定",
        callback: (action) => {
    
    
        }
      }
    )

2. Confirm pop-up window

"Confirm" and "Cancel" button operations can be performed in the window

this.$confirm('提示信息?', '提示', {
    
    
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
    
    
          this.$message({
    
    
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
    
    
          this.$message({
    
    
            type: 'info',
            message: '已取消删除'
          });          
       });

Click the OK button to call the content specified by the then method. Click the Cancel button to call the content specified by the catch method;
if the method in then throws an error during running, it will also be caught by the catch method.

3. prompt pop-up window

The window can carry out "Confirm" and "Cancel" button operations, and there is an input box for entering text.

The prompt message box provides a text field in which users can enter an answer in response to your prompt. The message box has an "OK" button and a "Cancel" button. If you provide an auxiliary string parameter, the prompt message box will display the auxiliary string in the text field as the default response. Otherwise, the default text is "".
Like the alert( ) and confirm( ) methods, the prompt method also displays a modal message box. The user must close the message box before continuing.
For example: var theResponse = window.prompt("Welcome?", "Please enter your name here.");
Insert image description here

Guess you like

Origin blog.csdn.net/m0_46459413/article/details/129040289