mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-03 12:19:07 +08:00
perf: 优化过滤器体验,提示错误内容
This commit is contained in:
parent
d774a52c4f
commit
dea849cfdb
@ -122,23 +122,28 @@ const calcData = (data: any, type?: string) => {
|
|||||||
|
|
||||||
// 数据解析
|
// 数据解析
|
||||||
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
const calcCapsuleLengthAndLabelData = (dataset: any) => {
|
||||||
const { source } = dataset
|
try {
|
||||||
if (!source.length) return
|
const { source } = dataset
|
||||||
|
if (!source || !source.length) return
|
||||||
|
|
||||||
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight)
|
||||||
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
const capsuleValue = source.map((item: DataProps) => item[state.mergedConfig.dataset.dimensions[1]])
|
||||||
|
|
||||||
const maxValue = Math.max(...capsuleValue)
|
const maxValue = Math.max(...capsuleValue)
|
||||||
|
|
||||||
state.capsuleValue = capsuleValue
|
state.capsuleValue = capsuleValue
|
||||||
|
|
||||||
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
state.capsuleLength = capsuleValue.map((v: any) => (maxValue ? v / maxValue : 0))
|
||||||
|
|
||||||
const oneFifth = maxValue / 5
|
const oneFifth = maxValue / 5
|
||||||
|
|
||||||
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
const labelData = Array.from(new Set(new Array(6).fill(0).map((v, i) => Math.ceil(i * oneFifth))))
|
||||||
|
|
||||||
state.labelData = labelData
|
state.labelData = labelData
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberSizeHandle = (val: string | number) => {
|
const numberSizeHandle = (val: string | number) => {
|
||||||
|
@ -150,7 +150,7 @@ const filterRes = computed(() => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
errorFlag.value = true
|
errorFlag.value = true
|
||||||
return '过滤函数错误'
|
return `过滤函数错误,日志:${error}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user