场景1:"< script >"中使用

Notification 通知

<template>
    <el-button @click="func1">el-button</el-button> 
</template>

<script>
import { h } from 'vue';

export default {
  methods: {
    func1() {
      this.$notify({
        title: '标题',
        message: h('i', { style: 'color: teal'}, '内容')
      });
    },
  }
}
</script>

场景2:"< script setup >"中使用

vue3.x + elementplus组合式api怎么实现$this.confirm和$this.message

<template>
    <el-button @click="func1">el-button</el-button> 
</template>

<script setup>
import { getCurrentInstance,h,onMounted } from 'vue'
import {ElNotification} from 'element-plus'

const app = getCurrentInstance()
console.log(app);

function func1() {
  ElNotification({
    title: '标题',
    message: h('i', { style: 'color: teal'}, '内容')
  });
}

onMounted(() => {
  console.log(ElNotification)
})
</script>
Logo

前往低代码交流专区

更多推荐