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

59 lines
875 B
Vue
Raw Permalink Normal View History

2024-05-07 05:46:42 +00:00
<template>
2024-06-01 16:21:36 +00:00
<view class="text-singe-line">{{title}}</view>
2024-05-07 05:46:42 +00:00
</template>
<script>
export default {
computed: {
title() {
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(",")
}
2024-05-22 17:48:52 +00:00
val = 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(',')
}
2024-05-22 17:48:52 +00:00
val = val || this.text || this.placeholder
return val
2024-05-07 05:46:42 +00:00
}
},
props: {
value: {
},
2024-05-22 17:48:52 +00:00
text: {
},
2024-05-07 05:46:42 +00:00
list: {
},
2024-05-19 05:56:23 +00:00
checkedList: {
},
2024-05-22 17:48:52 +00:00
placeholder: {
default () {
return '-'
}
},
2024-05-07 05:46:42 +00:00
},
data() {
return {
}
},
created() {
},
onHide() {
},
unmounted() {},
methods: {
}
}
</script>
<style scoped lang="scss">
</style>