提交 ecbe3d73 编写于 作者: D DebugIsFalse

Create LineChart.global.vue

上级 d083af8c
<template>
<div class="w-full">
<canvas id="chart"></canvas>
</div>
</template>
<script setup>
import { Chart } from 'chart.js/auto';
const props = defineProps({
title: {
type: String,
default: ''
},
labels: {
type: Array,
default: () => []
},
data: {
type: Array,
default: () => []
}
})
onMounted(() => {
new Chart(document.getElementById('chart'), {
type: 'line',
data: {
labels: props.labels,
datasets: [
{
label: props.title,
data: props.data
}
]
}
})
})
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册