<calendar v-show="selTrip == 0" @change="change" :modal="true" :beginDate="singleTrip.goTime" :selType="calendarData.selType" :show="calendarData.showCaledar" ></calendar>
<calendar v-show="selTrip == 1" @change="change" :modal="true" :beginDate="doubleTrip.doubleGoTime" :endDate="doubleTrip.doubleBackTime" :selType="calendarData.selType" :show="calendarData.showCaledar" ></calendar>
<calendar v-show="selTrip == 2" @change="change" :modal="true" :beginDate="calendarData.beginDate" :selType="calendarData.selType" :show="calendarData.showCaledar" ></calendar>
向上面的 使用了3个日期组件 但打开组件对其他有影响了 如第二个组件内容有时还是第一个的
3 个回复
DCloud_UNI_HT
注意组件内 ,变量不要定义在全局 。定义在全局势必会有所影响。
W小姐
当绑定在组件上的数据是数组时,在修改组件内对应数组时,不用通讯,页面内对应的数组也会被改变,但如果数据是字符串时,则需要通讯才能改变页面内的数据,这个问题我在使用components和subNvue的时候都遇到了,我目前理解为绑定数组时,其实是绑定的数组对应的路径,页面和组件是同一个路径,当组件修改了路径对应的数组,页面中的数组也被修改。可以去百度搜一下数组的深度复制
顺哥
后面怎么解决这问题?