parent
440aeee070
commit
3efe08007d
@ -0,0 +1,49 @@ |
||||
<template> |
||||
<span> |
||||
<template v-for="(item, index) in options"> |
||||
<template v-if="values[index]==index"> |
||||
{{ item.label }} |
||||
</template> |
||||
</template> |
||||
</span> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: "BaseDict", |
||||
props: { |
||||
options: { |
||||
type: Array, |
||||
default: null, |
||||
}, |
||||
value: [Number, String, Array], |
||||
}, |
||||
data() { |
||||
return { |
||||
status: false |
||||
} |
||||
}, |
||||
computed: { |
||||
values() { |
||||
let length = this.options.length |
||||
if (this.value !== null && typeof this.value !== 'undefined') { |
||||
return this.options.map((item, index) => { |
||||
let array = item.value.split('-') |
||||
if (parseFloat(array[0]) <= parseFloat(this.value) && parseFloat(this.value) < parseFloat(array[1])) { |
||||
return index |
||||
}else if (1 <= parseFloat(this.value)) { |
||||
return length-1 |
||||
} |
||||
}); |
||||
} else { |
||||
return ''; |
||||
} |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
<style scoped> |
||||
.el-tag + .el-tag { |
||||
margin-left: 10px; |
||||
} |
||||
</style> |
Loading…
Reference in new issue