fix:主子表 props

This commit is contained in:
puhui999 2024-02-28 00:07:25 +08:00
parent c4ff0a1038
commit c3337f21ce

View File

@ -94,7 +94,7 @@ const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗 const message = useMessage() // 消息弹窗
const props = defineProps<{ const props = defineProps<{
${subJoinColumn.javaField}: undefined // ${subJoinColumn.columnComment}(主表的关联字段) ${subJoinColumn.javaField}?: number // ${subJoinColumn.columnComment}(主表的关联字段)
}>() }>()
const loading = ref(false) // 列表的加载中 const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据 const list = ref([]) // 列表的数据
@ -103,17 +103,20 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
${subJoinColumn.javaField}: undefined ${subJoinColumn.javaField}: undefined as unknown
}) })
/** 监听主表的关联字段的变化,加载对应的子表数据 */ /** 监听主表的关联字段的变化,加载对应的子表数据 */
watch( watch(
() => props.${subJoinColumn.javaField}, () => props.${subJoinColumn.javaField},
(val) => { (val: number) => {
if (!val) {
return
}
queryParams.${subJoinColumn.javaField} = val queryParams.${subJoinColumn.javaField} = val
handleQuery() handleQuery()
}, },
{ immediate: false } { immediate: true, deep: true }
) )
#end #end