提交 bc20a18a 编写于 作者: M mehaotian

fix: calendar $data 报错

上级 29b9a2f1
...@@ -87,7 +87,9 @@ export default { ...@@ -87,7 +87,9 @@ export default {
// 点击具体的日历格子 // 点击具体的日历格子
clickGrid (x: number, y: number) { clickGrid (x: number, y: number) {
// 小格子数组 // 小格子数组
const gridArray = this.$data.$coords // const gridArray = this.$data.$coords
const calendar = this.$data['$calendar'] as Calendar
const gridArray = this.$data['$coords'] as Array<CoordsType>
// 遍历小格子数组,找到最接近点击坐标的小格子 // 遍历小格子数组,找到最接近点击坐标的小格子
for (let i = 0; i < gridArray.length; i++) { for (let i = 0; i < gridArray.length; i++) {
...@@ -103,7 +105,7 @@ export default { ...@@ -103,7 +105,7 @@ export default {
if (is_select) { if (is_select) {
const data = grid.data const data = grid.data
this.timeData = this.$data.$calendar.getDateInfo(data.fullDate) this.timeData = calendar.getDateInfo(data.fullDate)
this.drawWeek(this.weeks, grid.data.fullDate) this.drawWeek(this.weeks, grid.data.fullDate)
} }
} }
...@@ -111,10 +113,11 @@ export default { ...@@ -111,10 +113,11 @@ export default {
// 切换上个月 // 切换上个月
preDate () { preDate () {
const fulldate = this.timeData.fullDate const fulldate = this.timeData.fullDate
const time = this.$data.$calendar.getDate(fulldate, -1, 'month') const calendar = this.$data['$calendar'] as Calendar
this.timeData = this.$data.$calendar.getDateInfo(time.fullDate) const time = calendar.getDate(fulldate, -1, 'month')
this.timeData = calendar.getDateInfo(time.fullDate)
this.weeks = this.$data.$calendar.getWeeks(time.fullDate) this.weeks = calendar.getWeeks(time.fullDate)
// 重新绘制日历 // 重新绘制日历
this.drawWeek(this.weeks, time.fullDate) this.drawWeek(this.weeks, time.fullDate)
...@@ -123,20 +126,22 @@ export default { ...@@ -123,20 +126,22 @@ export default {
// 切换下个他 // 切换下个他
nextDate () { nextDate () {
const fulldate = this.timeData.fullDate const fulldate = this.timeData.fullDate
const time = this.$data.$calendar.getDate(fulldate, 1, 'month') const calendar = this.$data['$calendar'] as Calendar
this.timeData = this.$data.$calendar.getDateInfo(time.fullDate) const time = calendar.getDate(fulldate, 1, 'month')
this.timeData = calendar.getDateInfo(time.fullDate)
this.weeks = this.$data.$calendar.getWeeks(time.fullDate) this.weeks = calendar.getWeeks(time.fullDate)
// 重新绘制日历 // 重新绘制日历
this.drawWeek(this.weeks, time.fullDate) this.drawWeek(this.weeks, time.fullDate)
}, },
// 回到今天 // 回到今天
gotoToday () { gotoToday () {
const time = this.$data.$calendar.getDate() const calendar = this.$data['$calendar'] as Calendar
this.timeData = this.$data.$calendar.getDateInfo(time.fullDate) const time = calendar.getDate()
this.timeData = calendar.getDateInfo(time.fullDate)
this.weeks = this.$data.$calendar.getWeeks(time.fullDate) this.weeks = calendar.getWeeks(time.fullDate)
// 重新绘制日历 // 重新绘制日历
this.drawWeek(this.weeks, time.fullDate) this.drawWeek(this.weeks, time.fullDate)
...@@ -183,7 +188,7 @@ export default { ...@@ -183,7 +188,7 @@ export default {
const one_height = height / week_len const one_height = height / week_len
if (time !== '') { if (time !== '') {
this.$data.$coords = [] this.$data['$coords'] = [] as Array<CoordsType>
ctx.reset() ctx.reset()
} }
...@@ -232,7 +237,10 @@ export default { ...@@ -232,7 +237,10 @@ export default {
height: day_height, height: day_height,
data: day_item data: day_item
} }
this.$data.$coords.push(coords)
// TODO 兼容安卓data内$开头的属性的赋值问题
let gridArr = this.$data['$coords'] as Array<CoordsType>
gridArr.push(coords)
// } // }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册