emis-app/components/tpx-text-dic/tpx-text-dic.vue

55 lines
867 B
Vue
Raw Normal View History

2024-05-07 05:46:42 +00:00
<template>
<text>{{title}}</text>
</template>
<script>
export default {
computed: {
title() {
let title = this.value
2024-05-08 07:27:30 +00:00
let val = this.value
if(val && this.list) {
2024-05-19 05:56:23 +00:00
if(!Array.isArray(val) && val.split) {
2024-05-08 07:27:30 +00:00
val = val.split(",")
}
title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
2024-05-07 05:46:42 +00:00
}
2024-05-19 05:56:23 +00:00
if(Array.isArray(this.checkedList)) {
val = this.checkedList.map(t=> t.title).join(',')
}
if((!title || title?.length == 0) && (this.list || this.checkedList?.length == 0)) {
title = '-'
}
2024-05-07 05:46:42 +00:00
return title
}
},
props: {
value: {
},
list: {
},
2024-05-19 05:56:23 +00:00
checkedList: {
},
2024-05-07 05:46:42 +00:00
},
data() {
return {
}
},
created() {
},
onHide() {
},
unmounted() {},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>