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