2022-09-05 21:09:21 +10:00

35 lines
573 B
Vue

<template>
<pre data-testid="pre" :style="style">{{ finalText }}</pre>
</template>
<script>
import { reactive, computed } from 'vue';
export default {
name: 'my-pre',
props: {
// deepscan-disable-next-line
style: {
type: Object,
},
object: {
type: Object,
},
text: {
type: String,
default: '',
},
},
setup(props, { emit }) {
props = reactive(props);
return {
finalText: computed(() =>
props.object ? JSON.stringify(props.object, null, 2) : props.text
),
};
},
};
</script>