vue3 element-plus 谁会改造ElMessageBox 组件

目的: 封装一个 myMessage 函数,可以传数组和字符串内容进去

import { ElMessageBox, ElMessage } from 'element-plus'
// 目的: 改造封装一个 myMessage 函数,可以传数组和字符串内容进去
export function myMessage2(str,title) {
  var newArr
  const h = this.$createElement; // 这里写错了
  if (Array.isArray(str)){ // 如果str传进来是数组,就遍历
    newArr =[]
    for(let i =0; i < str.length; i++){
      newArr.push(h('h2', null, str[i]))
    }
  }else{
    newArr = h('span', null , str)
  }
  ElMessageBox({
    title: title,
    message: h('h1', null, newArr),
    showCancelButton: false,
    confirmButtonText: 'OK',
  })
}


请给有效的代码
https://element-plus.gitee.io/zh-CN/component/message-box.html#%E4%B8%AA%E6%80%A7%E5%8C%96%E8%AE%BE%E7%BD%AE%E4%BD%A0%E7%9A%84%E5%BC%B9%E6%A1%86


        import {  h } from 'vue'
        import { ElMessageBox, ElMessage } from 'element-plus'
        // 目的: 改造封装一个 myMessage 函数,可以传数组和字符串内容进去
        export function myMessage2(str, title) {
            var newArr
            // const h = this.$createElement; // 这里写错了
            if (Array.isArray(str)) { // 如果str传进来是数组,就遍历
                newArr = []
                for (let i = 0; i < str.length; i++) {
                    newArr.push(h('h2', null, str[i]))
                }
            } else {
                newArr = h('span', null, str)
            }
            ElMessageBox({
                title: title,
                message: h('h1', null, newArr),
                showCancelButton: false,
                confirmButtonText: 'OK',
            })
        }

从vue中引入h函数