basic.vue 565 B

123456789101112131415161718192021222324
  1. <template>
  2. <el-button plain @click="open1"> Closes automatically </el-button>
  3. <el-button plain @click="open2"> Won't close automatically </el-button>
  4. </template>
  5. <script lang="ts" setup>
  6. import { h } from 'vue'
  7. import { ElNotification } from 'element-plus'
  8. const open1 = () => {
  9. ElNotification({
  10. title: 'Title',
  11. message: h('i', { style: 'color: teal' }, 'This is a reminder'),
  12. })
  13. }
  14. const open2 = () => {
  15. ElNotification({
  16. title: 'Prompt',
  17. message: 'This is a message that does not automatically close',
  18. duration: 0,
  19. })
  20. }
  21. </script>