Skip to content

Commit 3d6da9a

Browse files
committed
fix(examples): 增加 Sender 组件的键盘提交功能,支持加载状态和成功提示
1 parent 3868777 commit 3d6da9a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

examples/src/views/Sender.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<el-radio label="shiftEnter">Shift+Enter 提交</el-radio>
3232
</el-radio-group>
3333
</div>
34-
<el-x-sender v-model="submitContent" :submit-type="submitType" placeholder="尝试不同提交方式..." clearable></el-x-sender>
34+
<el-x-sender v-model="submitContent" :submit-type="submitType" :loading="enterLoading" placeholder="尝试不同提交方式..." clearable @submit="enterSubmit"></el-x-sender>
3535
<div class="demo-controls">
3636
<p>当前提交方式:{{ submitType === 'enter' ? 'Enter 提交,Shift+Enter 换行' : 'Shift+Enter 提交,Enter 换行' }}</p>
3737
</div>
@@ -184,6 +184,7 @@ export default {
184184
185185
// 提交方式
186186
submitType: 'enter',
187+
enterLoading:false,
187188
submitContent: '',
188189
189190
// 状态
@@ -237,7 +238,15 @@ export default {
237238
this.basicSubmitted = content
238239
this.basicContent = ''
239240
},
240-
241+
// 键盘提交
242+
enterSubmit(content){
243+
this.enterLoading = true
244+
setTimeout(() => {
245+
this.enterLoading = false
246+
this.submitContent = ''
247+
this.$message.success('提交成功:' + content)
248+
}, 2000)
249+
},
241250
// 加载状态
242251
handleLoadingSubmit(content) {
243252
this.isLoading = true

0 commit comments

Comments
 (0)