<template>
  <el-button text @click="open">Click to open the Message Box</el-button>
</template>
<script>
import { ElMessage, ElMessageBox } from 'element-plus';

export default {
  setup() {
    const open = () => {
      ElMessageBox.alert('This is a message', 'Title', {
        // if you want to disable its autofocus
        // autofocus: false,
        confirmButtonText: 'OK',
        callback: (action) => {
          ElMessage({
            type: 'info',
            message: `action: ${action}`,
          });
        },
      });
    };

    return {
      open,
    };
  },
};
</script>
Element Plus Message Box Example: Open and Display Confirmation

原文地址: https://www.cveoy.top/t/topic/nCeP 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录