refactor(components): 统一组件API规范并完善表单重置功能
- 将多个组件的props从具体属性名改为统一的value属性 - 为所有组件添加v-model支持,替换原有的具体属性绑定 - 统一实现resetField方法,确保表单重置功能一致性 - 修正组件内部数据绑定逻辑,使用innerValue替代直接修改prop - 更新文档示例,将API参数说明改为value | v-model格式 - 为代码编辑器、富文本编辑器等组件添加input事件发射 - 调整文件上传组件的值类型定义,从Object改为String - 移除废弃的maxLength回调方法,优化编辑器性能 - 重构双向绑定逻辑,确保父子组件数据同步正确性 - 为树形选择器添加ref引用以便操作内部实例 - 调整组件演示页面的导入路径和标签页名称结构
This commit is contained in:
@@ -31,8 +31,8 @@ export default {
|
||||
name: 'CuteFileUpload',
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
required: true,
|
||||
type: String,
|
||||
required: false,
|
||||
default: null
|
||||
},
|
||||
/**
|
||||
@@ -73,9 +73,10 @@ export default {
|
||||
// console.error('response', response)
|
||||
// console.error('file', file)
|
||||
// console.error('fileList', fileList)
|
||||
this.value.fileUrl = response
|
||||
// 绑定on-success事件
|
||||
this.$emit('on-success', response, file, fileList)
|
||||
this.$emit('change', response)
|
||||
this.$emit('input', response)
|
||||
},
|
||||
// 监听上传失败
|
||||
handleError(e, file, fileList) {
|
||||
@@ -83,6 +84,13 @@ export default {
|
||||
KitMessage.Error(msg.message)
|
||||
// 绑定on-error事件
|
||||
this.$emit('on-error', e, file, fileList)
|
||||
this.$emit('change', null)
|
||||
this.$emit('input', null)
|
||||
},
|
||||
resetField() {
|
||||
this.$refs.upload.clearFiles()
|
||||
this.$emit('change', null)
|
||||
this.$emit('input', null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user