refactor(diy-form): 兼容前后端命名格式,优化表单配置处理
1. 重构mergedFormConfig逻辑,同时支持camelCase和snake_case格式的配置项,camelCase优先读取 2. 调整ns-newform的mode参数读取mergedFormConfig的formLayout 3. 优化提示语样式,新增tipBorderColor支持显示底部边框 4. 修复submitText读取逻辑,改为从mergedFormConfig获取 5. 移除多余的console日志,更新注释说明
This commit is contained in:
@@ -60,12 +60,12 @@ export default {
|
||||
},
|
||||
formTip() {
|
||||
const tip = this.detail?.form_tip
|
||||
console.log('formTip computed, tip value:', tip, 'truthy:', !!tip)
|
||||
return tip ? tip : '请填写表单所需信息'
|
||||
},
|
||||
// 构造 diy-form raw 模式期望的 value 形态:
|
||||
// - jsonData:透传给 ns-newform(已是 ns-newform 期望的 [{ controller, value, val }])
|
||||
// - formConfig:snake_case 表单配置,diy-form 内部 mergedFormConfig 会做 camelCase 转换
|
||||
// - formConfig:后端返回 camelCase(如 formPaddingX / formBgColor / labelFontSize),
|
||||
// diy-form 内部 mergedFormConfig 同时兼容 snake_case 后再交给 ns-newform
|
||||
// - 不传 show_banner / show_tip:让 diy-form 自带的 banner/tip 不渲染(页面已自渲染)
|
||||
// 注:本 computed 只在 <block v-if="detail"> 内被消费,无需 null 守卫
|
||||
diyValue() {
|
||||
@@ -138,7 +138,6 @@ export default {
|
||||
success: res => {
|
||||
if (res.code == 0 && res.data) {
|
||||
this.detail = res.data
|
||||
console.log(`form data =>`, this.detail)
|
||||
this.updateNavbarTitle();
|
||||
}
|
||||
this.$refs.loadingCover && this.$refs.loadingCover.hide()
|
||||
|
||||
Reference in New Issue
Block a user