Skip to content

Commit 3789dc8

Browse files
committed
fix: remove isMarkdown property
1 parent b799c27 commit 3789dc8

File tree

6 files changed

+8
-25
lines changed

6 files changed

+8
-25
lines changed

packages/pro-components/chat/chat-content/_example/base/index.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<view class="chat-example">
2-
<view class="title">用户内容</view>
2+
<view class="title">用户内容纯文本支持HTML转义</view>
33
<view class="chat-example-block">
44
<t-chat-content content="{{userContent}}" role="user"></t-chat-content>
55
</view>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<t-navbar class="demo-navbar" title="ChatContent" leftArrow />
22
<view class="demo">
33
<t-demo-header title="ChatContent" desc="内容展示" notice="渲染框架支持情况:WebView" />
4-
<t-demo title="01 组件类型" desc="基础内容展示">
4+
<t-demo title="01 组件类型">
55
<base />
66
</t-demo>
77
</view>

packages/pro-components/chat/chat-markdown/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ isComponent: true
5454
名称 | 类型 | 默认值 | 描述 | 必传
5555
-- | -- | -- | -- | --
5656
content | String | '' | Markdown 格式的文本内容 | N
57-
isMarkdown | Boolean | true | 是否启用 Markdown 解析,false 时作为普通文本显示 | N
5857
options | Object | 见下方说明 | marked 解析器的配置选项 | N
5958

6059
### options 配置
@@ -138,7 +137,6 @@ t-class-link | 链接样式类
138137
```html
139138
<t-chat-markdown
140139
content="# 标题\n这是一段**粗体**文本。"
141-
theme="normal"
142140
/>
143141
```
144142

@@ -170,7 +168,6 @@ t-class-link | 链接样式类
170168
```html
171169
<t-chat-markdown
172170
content="{{complexMarkdown}}"
173-
theme="normal"
174171
/>
175172
```
176173

packages/pro-components/chat/chat-markdown/chat-markdown.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,10 @@ export default class ChatMarkdown extends SuperComponent {
1212
};
1313

1414
properties = {
15-
theme: {
16-
type: String,
17-
value: 'normal',
18-
},
1915
content: {
2016
type: String,
2117
value: '',
2218
},
23-
// 新增:支持直接传入markdown文本
24-
isMarkdown: {
25-
type: Boolean,
26-
value: true,
27-
},
2819
// 新增:marked配置选项(原 markedOptions 重命名为 options)
2920
options: {
3021
type: Object,
@@ -45,12 +36,7 @@ export default class ChatMarkdown extends SuperComponent {
4536
observers = {
4637
// 监听markdown文本变化,自动解析
4738
content: function (markdown: string) {
48-
// 判断isMarkdown是否为true
49-
if (this.data.isMarkdown) {
50-
this.parseMarkdown(markdown);
51-
} else {
52-
this.setData({ nodes: [] });
53-
}
39+
this.parseMarkdown(markdown);
5440
},
5541
};
5642

@@ -80,10 +66,6 @@ export default class ChatMarkdown extends SuperComponent {
8066

8167
lifetimes = {
8268
attached() {
83-
// 组件挂载后,如果有markdown文本,进行解析
84-
if (this.data.isMarkdown) {
85-
this.parseMarkdown(this.data.content);
86-
}
8769
},
8870
};
8971
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<wxs src="../../../components/common/utils.wxs" module="_" />
22

3-
<view class="class {{classPrefix}} {{classPrefix}}--{{theme}}" style="{{_._style([style, customStyle])}}">
3+
<view class="class {{classPrefix}} {{classPrefix}}--normal" style="{{_._style([style, customStyle])}}">
44
<chat-markdown-node nodes="{{nodes}}"></chat-markdown-node>
55
</view>

packages/tdesign-miniprogram/example/pages/home/data/chat.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const chat = {
1818
name: 'ChatMarkdown',
1919
label: '对话 Markdown',
2020
},
21+
{
22+
name: 'ChatContent',
23+
label: '对话正文',
24+
},
2125
{
2226
name: 'ChatThinking',
2327
label: '思考过程',

0 commit comments

Comments
 (0)