方案一:使用jsx +
<template>
<button @click="handleClick">点击我</button>
</template>
<script lang="jsx" setup name="">
import { message } from 'ant-design-vue';
const handleClick = (record) => {
message.warning(<span>我是第一行<br/>我是第二行</span>);
};
</script>
方案二:使用div标签 + map循环
<template>
<button @click="handleClick">点击我</button>
</template>
<script lang="jsx" setup name="">
import { message } from 'ant-design-vue';
const handleClick = (record) => {
const contentArray = ['我是第一行', '我是第二行', '我是第三行'];
message.error({
content: h(
'div',
{ style: 'display: inline-table;text-align: left;' },
contentArray.map((content) => h('div', content)),
),
});
};
</script>
因篇幅问题不能全部显示,请点此查看更多更全内容