hyperboria/nexus/cognitron/web/components/v-tr.vue
the-superpirate d51e5ab65d - fix: Various fixes for release
- fix: Translation fixes
- fix: Various fixes
- feat: PB translations, configuration changes
- fix: Bugfixes

GitOrigin-RevId: 55f8b148c42a296162fc707c36a5146ca0073b4b
2021-01-29 11:26:51 +03:00

63 lines
1.0 KiB
Vue

<template lang="pug">
tr(v-if="value")
th {{label}}
td(:class="valueClasses")
| {{formattedValue}}
cite
a(href="javascript:void(null);" @click="showMore" v-if="collapseText") show more...
</template>
<script>
export default {
name: 'VTr',
props: {
label: {
type: String,
required: true
},
valueClasses: {
type: String,
required: false
},
value: {
required: true,
default: null
},
maxLength: {
type: Number,
default: 300
}
},
data () {
return {
showAll: false
}
},
computed: {
collapseText () {
return this.value.length > this.maxLength && !this.showAll
},
formattedValue () {
if (this.value) {
if (this.collapseText) {
return this.value.substr(0, this.maxLength)
} else {
return this.value
}
}
return null
}
},
methods: {
showMore () {
this.showAll = true
}
}
}
</script>
<style scoped lang="scss">
</style>