Hzy0913 / mpvue-calendar

📅 A calendar component for vue3.0. Support gesture sliding, range selection, according to the week switch...
http://preview.binlive.cn/mpvue-calendar#/
MIT License
514 stars 105 forks source link

select-date属性不是响应式的? #131

Open 59637428 opened 2 years ago

59637428 commented 2 years ago

:select-date="rangeDate"
rangeDate定义为ref响应式,但是我通过函数更改rangeDate的值,日历组件内不会响应的高亮,只有初始设置的值生效

xutian111 commented 1 year ago

大哥你的问题解决了么

chenchen0224 commented 1 year ago

解决办法:

  1. vue:修改select-date 时,用 v-if 控制组件重新渲染
    state.isShow = false
    state.selectDate = ['2023-1-7', '2023-1-8']
    nextTick(() => {
    state.isShow = true
    })

    注意:日期格式不带0才会生效,'2023-01-07'是不会被选中的

1075951090 commented 1 month ago

用 v-if 控制组件重新渲染太消耗性能了,强烈要求作者select-date属性做成响应式