mirror of https://github.com/rancher/dashboard.git
50 lines
803 B
Vue
50 lines
803 B
Vue
<script>
|
|
import { get } from '@/utils/object';
|
|
|
|
export default {
|
|
props: {
|
|
row: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
|
|
value: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
|
|
longValueKey: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
|
|
tooltipPlacement: {
|
|
type: String,
|
|
default: 'auto'
|
|
},
|
|
},
|
|
|
|
computed: {
|
|
longValue() {
|
|
return get(this.row, this.longValueKey);
|
|
},
|
|
|
|
showTooltip() {
|
|
return !!this.longValue && this.value !== this.longValue;
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
|
|
<template>
|
|
<span v-if="!value" class="text-muted">
|
|
—
|
|
</span>
|
|
<span v-else-if="showTooltip" v-tooltip="{content: longValue, placement: tooltipPlacement}">
|
|
{{ value }}
|
|
</span>
|
|
<span v-else>
|
|
{{ value }}
|
|
</span>
|
|
</template>
|