Skip to content

Commit a3467e7

Browse files
committed
feat: add MessageBoxDemo, close #73
1 parent 82bdcb6 commit a3467e7

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ declare module 'vue' {
2222
ElTag: typeof import('element-plus/es')['ElTag']
2323
HelloWorld: typeof import('./components/HelloWorld.vue')['default']
2424
Logos: typeof import('./components/Logos.vue')['default']
25+
MessageBoxDemo: typeof import('./components/MessageBoxDemo.vue')['default']
2526
RouterLink: typeof import('vue-router')['RouterLink']
2627
RouterView: typeof import('vue-router')['RouterView']
2728
}

src/components/HelloWorld.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const value1 = ref(true)
3232
<el-button size="large" @click="toast">
3333
El Message
3434
</el-button>
35+
36+
<MessageBoxDemo />
3537
</div>
3638

3739
<div class="my-2 flex flex-wrap items-center justify-center text-center">

src/components/MessageBoxDemo.vue

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts" setup>
2+
import type { Action } from 'element-plus'
3+
import { ElMessage, ElMessageBox } from 'element-plus'
4+
5+
function open() {
6+
ElMessageBox.alert('This is a message', 'Title', {
7+
// if you want to disable its autofocus
8+
// autofocus: false,
9+
confirmButtonText: 'OK',
10+
callback: (action: Action) => {
11+
ElMessage({
12+
type: 'info',
13+
message: `action: ${action}`,
14+
})
15+
},
16+
})
17+
}
18+
</script>
19+
20+
<template>
21+
<el-button plain @click="open">
22+
Click to open the Message Box
23+
</el-button>
24+
</template>

src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import '~/styles/index.scss'
1717
import 'uno.css'
1818
// If you want to use ElMessage, import it.
1919
import 'element-plus/theme-chalk/src/message.scss'
20+
import 'element-plus/theme-chalk/src/message-box.scss'
2021

2122
// if you do not need ssg:
2223
// import { createApp } from "vue";

0 commit comments

Comments
 (0)