perf: 优化过滤器体验,提示错误内容

This commit is contained in:
奔跑的面条 2023-02-09 11:29:23 +08:00
parent d774a52c4f
commit dea849cfdb
2 changed files with 16 additions and 11 deletions

View File

@ -122,8 +122,9 @@ const calcData = (data: any, type?: string) => {
// //
const calcCapsuleLengthAndLabelData = (dataset: any) => { const calcCapsuleLengthAndLabelData = (dataset: any) => {
try {
const { source } = dataset const { source } = dataset
if (!source.length) return 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]])
@ -139,6 +140,10 @@ const calcCapsuleLengthAndLabelData = (dataset: any) => {
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) => {

View File

@ -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}`
} }
}) })