mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix(filter-rule): keep custom rule chip titles in sync with props (#474)
This commit is contained in:
@@ -28,19 +28,18 @@ function filtersChanged(value: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 过滤规则下拉框
|
// 过滤规则下拉框
|
||||||
const selectFilterOptions = ref<{ [key: string]: string }[]>([])
|
// 同时包含内置规则与用户自定义规则;使用 computed 而非 onMounted 一次性赋值,
|
||||||
|
// 是为了在父组件异步加载完 custom_rules 或后续新增/删除规则时,
|
||||||
onMounted(() => {
|
// 选项与已选 chip 的显示名(title)能跟随刷新,避免回退到原始 ID(如 "zhong")。
|
||||||
selectFilterOptions.value = cloneDeep(innerFilterRules)
|
const selectFilterOptions = computed<{ [key: string]: string }[]>(() => {
|
||||||
if (props.custom_rules) {
|
const options = cloneDeep(innerFilterRules)
|
||||||
console.log(props.custom_rules)
|
props.custom_rules?.forEach(rule => {
|
||||||
props.custom_rules.map(rule => {
|
options.push({
|
||||||
selectFilterOptions.value.push({
|
title: rule.name,
|
||||||
title: rule.name,
|
value: rule.id,
|
||||||
value: rule.id,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
return options
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user