Explorar el Código

Update VbFormItem组件prepend和append 添加disabled属性

Yue hace 8 meses
padre
commit
59312edccf

+ 12 - 0
UI/VAP_V3.VUE/src/components/form/VbFormItem.vue

@@ -132,6 +132,12 @@ const tipsIconClass = computed(() => {
 	return str
 })
 const hasPrepend = computed(() => {
+	if (
+		(typeof item.value.prependDisabled == "function" && item.value.prependDisabled(data.value)) ||
+		item.value.prependDisabled === true
+	) {
+		return false
+	}
 	return !!(item.value.prepend || item.value.prependIcon || item.value.prependClickFunc)
 })
 const hasPrependSlot = computed(() => {
@@ -156,6 +162,12 @@ function prependClickFunc() {
 }
 
 const hasAppend = computed(() => {
+	if (
+		(typeof item.value.appendDisabled == "function" && item.value.appendDisabled(data.value)) ||
+		item.value.appendDisabled === true
+	) {
+		return false
+	}
 	return !!(item.value.append || item.value.appendIcon || item.value.appendClickFunc)
 })
 

+ 4 - 2
UI/VAP_V3.VUE/src/components/form/models.ts

@@ -68,11 +68,13 @@ export interface VbFormItem {
 	tipsIcon?: string // 默认值  bi bi-question-circle-fill
 	tipsIconClass?: string // 默认值  text-muted
 	prepend: string | "slot" | "Slot" | "icon" | "Icon"
-	prependIcon?: string // prepend 为 el-button 中 icon 时显示的图标 默认值:Search
+	prependIcon?: string // prepend 为 el-button 中 icon 时显示的图标 默认值:bi bi-search text-primary
 	prependClickFunc?: (v: any) => void
+	prependDisabled?: boolean | ((v: any) => boolean)
 	append: string | "slot" | "Slot" | "icon" | "Icon"
-	appendIcon?: string // append 为 el-button 中 icon 时显示的图标 默认值:Search
+	appendIcon?: string // append 为 el-button 中 icon 时显示的图标 默认值:bi bi-search text-primary
 	appendClickFunc?: (v: any) => void
+	appendDisabled?: boolean | ((v: any) => boolean)
 }
 
 export interface VbFormRowItem {