<template>
  <n-code :code="recode" :language="language" show-line-numbers style="width: fit-content !important; padding: 10px" />
</template>
<script lang="ts" setup>
const recode = computed(() => {
  if (typeof prop.code === 'object') {
    return JSON.stringify(prop.code, null, 2);
  } else {
    return prop.code;
  }
});

const prop = defineProps({
  code: {
    type: [String, Object],
    required: true,
  },
  language: String,
});
</script>
<style lang="scss" scoped></style>
