mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-28 03:27:54 +08:00
feat:在ExtraSourceView中添加默认过滤参数支持,确保过滤条件的完整性
This commit is contained in:
@@ -2,12 +2,16 @@
|
|||||||
import { DiscoverSource } from '@/api/types'
|
import { DiscoverSource } from '@/api/types'
|
||||||
import MediaCardListView from '@/views/discover/MediaCardListView.vue'
|
import MediaCardListView from '@/views/discover/MediaCardListView.vue'
|
||||||
import FormRender from '@/components/render/FormRender.vue'
|
import FormRender from '@/components/render/FormRender.vue'
|
||||||
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
// 输入参数
|
// 输入参数
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
source: DiscoverSource
|
source: DiscoverSource
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
// 默认输入参数
|
||||||
|
const default_params = cloneDeep(props.source.filter_params)
|
||||||
|
|
||||||
// 过滤参数
|
// 过滤参数
|
||||||
const filterParams = reactive(props.source.filter_params)
|
const filterParams = reactive(props.source.filter_params)
|
||||||
|
|
||||||
@@ -16,6 +20,12 @@ const currentKey = ref(0)
|
|||||||
|
|
||||||
// 类型和过滤参数变化后重新刷新列表
|
// 类型和过滤参数变化后重新刷新列表
|
||||||
watch([filterParams], () => {
|
watch([filterParams], () => {
|
||||||
|
// 检查每个值,如果没有值但有默认值时,设置为默认值
|
||||||
|
for (const key in filterParams) {
|
||||||
|
if (!filterParams[key] && default_params[key]) {
|
||||||
|
filterParams[key] = default_params[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
currentKey.value++
|
currentKey.value++
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user