WIP #300 Tried to extract out an independent vue component to prevent shared primevue option
This commit is contained in:
25
src/views/Discover/Performance/FreqChart.vue
Normal file
25
src/views/Discover/Performance/FreqChart.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<template>
|
||||
<Chart type="line" :data="freqChartData" :options="freqChartOptions" class="h-96" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { computed } from 'vue';
|
||||
import { mapState, mapActions } from 'pinia';
|
||||
import usePerformanceStore from "@/stores/performance.js";
|
||||
|
||||
// 如果把 chart 獨立成一個 vue component
|
||||
// 是否可以防止 PrimeVue 誤用其他圖表 option 值的 bug?
|
||||
export default {
|
||||
setup() {
|
||||
const performanceStore = usePerformanceStore();
|
||||
|
||||
const freqChartData = computed(() => performanceStore.freqChartData);
|
||||
const freqChartOptions = computed(() => performanceStore.freqChartOptions);
|
||||
|
||||
return {
|
||||
freqChartData,
|
||||
freqChartOptions,
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user