Skip to content

Commit d020a17

Browse files
committed
refactor(ChatSender): remove type property from upload configuration and update related logic
1 parent 7813d15 commit d020a17

File tree

4 files changed

+3
-14
lines changed

4 files changed

+3
-14
lines changed

packages/pro-components/chat/chat-list/_example/docs/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ Component({
6868
{
6969
name: 'upload',
7070
presets: ['uploadCamera', 'uploadImage', 'uploadAttachment'],
71-
type: 'bottom',
7271
status: '',
7372
},
7473
{

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ Array<
112112
| {
113113
name: 'upload', // 固定为上传入口
114114
presets: string[], // 上传入口类型数组(如 ['uploadImage', 'uploadCamera', 'uploadAttachment'])
115-
type: 'popup' | 'bottom', // 上传入口展现方式:弹出层或底部
116115
status?: string, // 可选,'disabled' 时按钮不可用
117116
}
118117
| {
@@ -136,7 +135,6 @@ Array<
136135
{
137136
name: 'upload',
138137
presets: ['uploadImage', 'uploadCamera', 'uploadAttachment'],
139-
type: 'popup',
140138
status: '',
141139
},
142140
{
@@ -152,7 +150,6 @@ Array<
152150
{
153151
name: 'upload',
154152
presets: ['uploadImage', 'uploadAttachment'],
155-
type: 'popup',
156153
},
157154
{
158155
name: 'send',
@@ -167,7 +164,6 @@ Array<
167164
{
168165
name: 'upload',
169166
presets: ['uploadCamera'],
170-
type: 'bottom',
171167
},
172168
{
173169
name: 'send',
@@ -182,7 +178,6 @@ Array<
182178
{
183179
name: 'upload',
184180
presets: ['uploadImage', 'uploadCamera'],
185-
type: 'popup',
186181
status: 'disabled',
187182
},
188183
{

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export default class ChatSender extends SuperComponent {
7575
{
7676
name: 'upload',
7777
presets: ['uploadCamera', 'uploadImage', 'uploadAttachment'],
78-
type: 'popup',
7978
status: '',
8079
},
8180
{
@@ -230,13 +229,10 @@ export default class ChatSender extends SuperComponent {
230229
},
231230

232231
handleUploadClick(e) {
233-
const { type, status } = e.currentTarget.dataset;
232+
const { status } = e.currentTarget.dataset;
234233
this.triggerEvent('uploadClick');
235234
// 禁用状态不显示上传面板
236235
if (this.data.disabled || status === 'disabled') return;
237-
this.setData({
238-
uploadPlacement: type,
239-
});
240236
// 点击按钮切换面板显示状态
241237
this.triggerEvent('updateVisible', !this.data.visible);
242238
// 透传处理上传按钮点击事件,由业务侧控制是否显示上传面板

packages/pro-components/chat/chat-sender/chat-sender.wxml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@
6464
<view>
6565
<block wx:if="{{item.name === 'upload'}}">
6666
<view class="plus-btn {{item.status === 'disabled' ? 'disabled' : ''}}">
67-
<block wx:if="{{item.type === 'bottom'}}">
67+
<block>
6868
<view
6969
class="btn-func"
70-
data-type="{{item.type}}"
7170
data-status="{{item.status}}"
7271
catchtap="handleUploadClick"
7372
>
@@ -111,7 +110,7 @@
111110
</view>
112111
</view>
113112
</view>
114-
<view wx:if="{{visible && uploadPlacement === 'bottom'}}" class="{{classPrefix}}__upload" catchtap="handleUploadClick">
113+
<view wx:if="{{visible}}" class="{{classPrefix}}__upload" catchtap="handleUploadClick">
115114
<block wx:for="{{uploadNames}}" wx:for-item="name" wx:for-index="index" wx:key="index">
116115
<view class="{{classPrefix}}__upload-item" data-name="{{name}}" bindtap="handleUploadEntryClick">
117116
<view class="{{classPrefix}}__upload-item__icon">

0 commit comments

Comments
 (0)