feat: 动态日期,初始化日期

This commit is contained in:
Ming 2023-05-22 11:38:38 +08:00
parent a2184b19b3
commit 76e511daa0

View File

@ -56,7 +56,6 @@ const onChange = (v: number | number[]) => {
}
}
//
watch(
() => props.chartConfig.option.dataset,
(newData: number | number[]) => {
@ -68,6 +67,25 @@ watch(
immediate: true
}
)
//
watch(
() => props.chartConfig.option.differValue,
(newData: number) => {
if (props.chartConfig.option.differValue === 0) return
if (typeof option.dataset === 'object') {
option.dataset[0] = dayjs().add(newData, 'day').valueOf()
option.dataset[1] = dayjs().add(newData, 'day').valueOf()
} else {
option.dataset = dayjs().add(newData, 'day').valueOf()
}
//
onChange(newData)
},
{
immediate: true
}
)
</script>
<style lang="scss" scoped>