提交 e6464ca7 编写于 作者: View Design's avatar View Design

图表

上级 3d076287
......@@ -30,7 +30,7 @@ const errorTitle = computed(() => {
if (!title) {
const code = props.code
if (code === 404) title = 'Not found'
else if (code === 500) title = 'Error'
else if (code === 500 || code === 502) title = 'Error'
else if (code === 403) title= 'Forbidden'
}
return title
......@@ -40,7 +40,7 @@ const errorDescription = computed(() => {
if (!description) {
const code = props.code
if (code === 404) description = '抱歉,当前访问的内容不存在或被删除'
else if (code === 500) description = '抱歉,当前内容出现错误'
else if (code === 500 || code === 502) description = '抱歉,当前内容出现错误'
else if (code === 403) description= '抱歉,您没有权限访问当前内容'
}
return description
......
......@@ -8,10 +8,10 @@
<template v-if="item.ready">
<template v-if="item.type === 'search_relate_repo'">
<template v-if="item.data.length">
<template v-for="(chart, cIndex) in item.data" :key="cIndex">
<UCard :ui="cardUI">
<ProseChart
type="line"
title="Star 数据"
:labels="item.labels"
:data="item.data"
:info="item.info"
......@@ -19,6 +19,7 @@
/>
</UCard>
</template>
</template>
<template v-else>
<UCard :ui="cardUI">
<IEmpty size="xs"/>
......
<template>
<div class="w-full relative" style="aspect-ratio: 2/1">
<canvas ref="refChart" :aria-label="title"></canvas>
</div>
<template v-if="info.length">
<template v-if="info">
<div class="mt-2 flex flex-col gap-1">
<template v-for="item in info" :key="item.name">
<div class="flex items-center gap-1 text-sm">
<UIcon class="flex-shrink-0" name="i-simple-icons-github" />
<ULink class="line-clamp-1 underline" :to="item.url" target="_blank" :title="item.description">{{ item.name }}</ULink>
<ULink class="line-clamp-1 underline" :to="info.url" target="_blank" :title="info.description">{{ info.name }}</ULink>
<UIcon class="flex-shrink-0" name="i-heroicons-arrow-top-right-on-square" />
</div>
</template>
</div>
</template>
<div class="w-full relative" style="aspect-ratio: 2/1">
<canvas ref="refChart" :aria-label="title"></canvas>
</div>
</template>
<script setup>
import { Chart } from 'chart.js/auto';
......@@ -40,8 +38,8 @@ const props = defineProps({
default: false
},
info: {
type: Array,
default: () => []
type: Object,
default: () => {}
}
})
const refChart = ref(null)
......@@ -68,7 +66,7 @@ function init () {
maintainAspectRatio: false,
plugins: {
title: {
display: true,
display: !props.simple,
text: props.title,
font: {
size: 14,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册