1、官网地址:
Ant Design Vue — An enterprise-class UI components based on Ant Design and Vue.js
2、显示个信息:
Modal.info({
title: 'This is a notification message',
content: h('div', {}, [
h('p', 'some messages...some messages...'),
h('p', 'some messages...some messages...'),
]),
onOk() {
console.log('ok');
},
});
3、上面是content是换行的
<template>
<a-space wrap>
<a-button @click="info">Info</a-button>
<a-button @click="success">Success</a-button>
<a-button @click="error">Error</a-button>
<a-button @click="warning">Warning</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { Modal } from 'ant-design-vue';
import { h } from 'vue';
const info = () => {
Modal.info({
title: 'This is a notification message',
content: h('div', {}, [
h('p', 'some messages...some messages...'),
h('p', 'some messages...some messages...'),
]),
onOk() {
console.log('ok');
},
});
};
const success = () => {
Modal.success({
title: 'This is a success message',
content: h('div', {}, [
h('p', 'some messages...some messages...'),
h('p', 'some messages...some messages...'),
]),
});
};
const error = () => {
Modal.error({
title: 'This is an error message',
content: 'some messages...some messages...',
});
};
const warning = () => {
Modal.warning({
title: 'This is a warning message',
content: 'some messages...some messages...',
});
};
</script>
4、vue3 h函数
https://cn.vuejs.org/api/render-function.html#h