perf: 优化补丁的判单方式

This commit is contained in:
奔跑的面条 2022-10-11 16:02:43 +08:00
parent e187c012cc
commit c84f6d9c33
4 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
if (!isObject(newData) || !('dimensions' in newData)) return
if (newData?.dimensions.length !== oldData?.dimensions.length) {
if (Array.isArray(newData?.dimensions)) {
const seriesArr = []
for (let i = 0; i < newData.dimensions.length - 1; i++) {
seriesArr.push(seriesItem)

View File

@ -53,7 +53,7 @@ watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
if (!isObject(newData) || !('dimensions' in newData)) return
if (newData?.dimensions.length !== oldData?.dimensions.length) {
if (Array.isArray(newData?.dimensions)) {
const seriesArr = []
for (let i = 0; i < newData.dimensions.length - 1; i++) {
seriesArr.push(seriesItem)

View File

@ -54,7 +54,7 @@ watch(
() => props.chartConfig.option.dataset,
(newData: { dimensions: any }, oldData) => {
if (!isObject(newData) || !('dimensions' in newData)) return
if (newData?.dimensions.length !== oldData?.dimensions.length) {
if (Array.isArray(newData?.dimensions)) {
const seriesArr = []
for (let i = 0; i < newData.dimensions.length - 1; i++) {
seriesArr.push(seriesItem)

View File

@ -70,7 +70,7 @@ watch(
() => props.chartConfig.option.dataset,
(newData, oldData) => {
if (!isArray(newData)) return
if (newData?.length !== oldData?.length) {
if (Array.isArray(newData)) {
replaceMergeArr.value = ['series']
// eslint-disable-next-line vue/no-mutating-props
props.chartConfig.option.series = newData.map((item: { dimensions: any[] }, index: number) => ({