26 lines
468 B
Vue
26 lines
468 B
Vue
<template>
|
|
<div>
|
|
<n-code :code="recode" :language="language" show-line-numbers />
|
|
</div>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
const recode = ref('');
|
|
|
|
const prop = defineProps({
|
|
code: {
|
|
type: [String, Object],
|
|
required: true,
|
|
},
|
|
language: String,
|
|
});
|
|
|
|
onMounted(() => {
|
|
if (typeof prop.code === 'object') {
|
|
recode.value = JSON.stringify(prop.code, null, 2);
|
|
} else {
|
|
recode.value = prop.code;
|
|
}
|
|
});
|
|
</script>
|
|
<style scoped></style>
|