update
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ref, watch, toRefs, nextTick } from 'vue'
|
||||
import { ref, watch, toRefs, nextTick, onMounted } from 'vue'
|
||||
import Highcharts from 'highcharts'
|
||||
import 'highcharts/css/highcharts.scss'
|
||||
import Loader from '@/components/Loader.vue'
|
||||
@@ -37,7 +37,6 @@ export default {
|
||||
try {
|
||||
const [start, end] = [window.value.getStart(), window.value.getEnd()]
|
||||
const sample = Math.round((end - start) / 60 / 288) || 1
|
||||
console.log(import.meta.env.MODE)
|
||||
const host = import.meta.env.MODE === 'development' ? 'http://localhost:3000' : ''
|
||||
const fetchUrl = `${host}/type/${typeApi[type.value]}/startDate/${start}/endDate/${end}/sample/${sample}`
|
||||
const response = await fetch(fetchUrl)
|
||||
@@ -87,8 +86,14 @@ export default {
|
||||
fetchData()
|
||||
}
|
||||
})
|
||||
watch(data, () => {
|
||||
nextTick(() => renderChart())
|
||||
onMounted(() => {
|
||||
watch(
|
||||
data,
|
||||
() => {
|
||||
if (data.value.length > 0) nextTick(() => renderChart())
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
})
|
||||
return {
|
||||
loading,
|
||||
|
||||
Reference in New Issue
Block a user