12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <template>
- <div class="main_app">
- <el-button type="text" @click="dialogVisible = true"
- >click to open the Dialog</el-button
- >
- <el-dialog
- v-model="dialogVisible"
- title="Tips"
- width="30%"
- :before-close="handleClose"
- >
- <span>This is a message</span>
- <template #footer>
- <span class="dialog-footer">
- <el-button @click="dialogVisible = false">Cancel</el-button>
- <el-button type="primary" @click="dialogVisible = false"
- >Confirm</el-button
- >
- </span>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { ElMessageBox } from 'element-plus'
- const dialogVisible = ref(false)
- const handleClose = ( done => {
- ElMessageBox.confirm('Are you sure to close this dialog?')
- .then(() => {
- done()
- })
- .catch(() => {
- // catch error
- })
- });
- </script>
- <style>
- .main_app {
- font-family: 'Avenir', Helvetica, Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- text-align: center;
- color: #2c3e50;
- margin-top: 60px;
- }
- </style>
|