gctGenerator/docs/.vuepress/components/CodeInfo.vue

42 lines
868 B
Vue
Raw Normal View History

2020-06-28 06:33:20 +09:00
<template>
<div>
2020-06-29 03:04:31 +09:00
<h3 v-if="anchor" :id="headerId">
<a :href="`#${headerId}`" class="header-anchor">#</a>
{{ code.title }}
</h3>
<h3 v-else>{{ code.title }}</h3>
2020-06-28 06:33:20 +09:00
<div class="metadata">
<span>Version: {{ code.version }} ({{ code.date }})</span>
<span v-if="code.author.includes(',')">Authors: {{ code.author }}</span>
<span v-else>Author: {{ code.author }}</span>
</div>
<p class="description" v-html="code.description"></p>
</div>
</template>
<script>
export default {
props: {
2020-06-29 03:04:31 +09:00
anchor: { type: Boolean },
2020-06-28 06:33:20 +09:00
code: { type: Object },
},
2020-06-29 03:04:31 +09:00
data() {
return {
headerId: this.code.title.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-'),
};
},
2020-06-28 06:33:20 +09:00
};
</script>
<style scoped>
.metadata span {
display: block;
font-style: italic;
font-size: 0.9rem;
}
.description td {
padding: 0;
}
</style>