emis-sapp/components/tpx-text-dic/tpx-text-dic.vue
2024-06-02 23:02:19 +08:00

59 lines
875 B
Vue

<template>
<view class="text-singe-line">{{title}}</view>
</template>
<script>
export default {
computed: {
title() {
let val = this.value
if(val && this.list) {
if(!Array.isArray(val) && val.split) {
val = val.split(",")
}
val = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
}
if(Array.isArray(this.checkedList)) {
val = this.checkedList.map(t=> t.title).join(',')
}
val = val || this.text || this.placeholder
return val
}
},
props: {
value: {
},
text: {
},
list: {
},
checkedList: {
},
placeholder: {
default () {
return '-'
}
},
},
data() {
return {
}
},
created() {
},
onHide() {
},
unmounted() {},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>