Commit 76149332 authored by 黄卓's avatar 黄卓

过滤字典项,用于只使用部分字典项的场景

parent de70c170
...@@ -45,7 +45,14 @@ export default { ...@@ -45,7 +45,14 @@ export default {
default: true default: true
}, */ }, */
defaultable: Boolean, // 是否默认选择第一个 defaultable: Boolean, // 是否默认选择第一个
disabled: Boolean disabled: Boolean,
/**
* 过滤字典项,用于只使用部分字典项的场景
*/
filter: {
type: Function,
default: () => true
}
}, },
data(){ data(){
return { return {
...@@ -54,7 +61,7 @@ export default { ...@@ -54,7 +61,7 @@ export default {
}, },
computed:{ computed:{
dictList(){ dictList(){
return this.getList(this.type) return this.getList(this.type).filter(this.filter)
}, },
formattedList(){ formattedList(){
let arr = [] let arr = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment