small update
This commit is contained in:
parent
6ca9d89b8d
commit
a25fb939b3
1 changed files with 0 additions and 5 deletions
|
|
@ -137,11 +137,9 @@ const chartOptions = {
|
||||||
watch(
|
watch(
|
||||||
() => props.chartsData,
|
() => props.chartsData,
|
||||||
(newData) => {
|
(newData) => {
|
||||||
// Сброс состояния
|
|
||||||
showPlaceholder.value = false
|
showPlaceholder.value = false
|
||||||
placeholderMessage.value = ''
|
placeholderMessage.value = ''
|
||||||
|
|
||||||
// Случай 1: null или undefined
|
|
||||||
if (newData === null || newData === undefined) {
|
if (newData === null || newData === undefined) {
|
||||||
showPlaceholder.value = true
|
showPlaceholder.value = true
|
||||||
placeholderMessage.value = 'No prices found'
|
placeholderMessage.value = 'No prices found'
|
||||||
|
|
@ -149,7 +147,6 @@ watch(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Случай 2: явная ошибка в объекте
|
|
||||||
if (typeof newData === 'object' && newData.error) {
|
if (typeof newData === 'object' && newData.error) {
|
||||||
showPlaceholder.value = true
|
showPlaceholder.value = true
|
||||||
placeholderMessage.value = newData.error
|
placeholderMessage.value = newData.error
|
||||||
|
|
@ -157,13 +154,11 @@ watch(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Случай 3: нормальный объект — пробуем преобразовать
|
|
||||||
let datasets = []
|
let datasets = []
|
||||||
if (newData.origins && Array.isArray(newData.origins)) {
|
if (newData.origins && Array.isArray(newData.origins)) {
|
||||||
datasets = transformToChartJSSeries(newData)
|
datasets = transformToChartJSSeries(newData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 🔥 Ключевое изменение: проверяем, есть ли хоть один датасет
|
|
||||||
if (datasets.length === 0) {
|
if (datasets.length === 0) {
|
||||||
showPlaceholder.value = true
|
showPlaceholder.value = true
|
||||||
placeholderMessage.value = 'No prices found'
|
placeholderMessage.value = 'No prices found'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue