feat(ui): text使用p渲染

This commit is contained in:
roymondchen 2023-06-08 14:30:43 +08:00
parent bdad1a41f9
commit 391fceef30
3 changed files with 5 additions and 5 deletions

View File

@ -32,9 +32,9 @@ const Text: React.FC<TextProps> = ({ config }) => {
if (!app) return null; if (!app) return null;
return ( return (
<div className="magic-ui-text" style={app.transformStyle(config.style || {})} id={`${config.id || ''}`}> <p className="magic-ui-text" style={app.transformStyle(config.style || {})} id={`${config.id || ''}`}>
{config.text} {config.text}
</div> </p>
); );
}; };

View File

@ -54,9 +54,9 @@ export default defineComponent({
render() { render() {
const className = this.config?.multiple ? 'magic-ui-text' : 'magic-ui-text magic-ui-text--single-line'; const className = this.config?.multiple ? 'magic-ui-text' : 'magic-ui-text magic-ui-text--single-line';
if (typeof this.$slots?.default === 'function') { if (typeof this.$slots?.default === 'function') {
return h('div', { class: className }, [this.$slots?.default?.() || '']); return h('p', { class: className }, [this.$slots?.default?.() || '']);
} }
return h('div', { return h('p', {
class: className, class: className,
domProps: { domProps: {
innerHTML: this.displayText, innerHTML: this.displayText,

View File

@ -1,5 +1,5 @@
<template> <template>
<span>{{ config.text }}</span> <p>{{ config.text }}</p>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>