vue-calendar icon indicating copy to clipboard operation
vue-calendar copied to clipboard

选择完一个月份的天数之后到另外一个月份选择天数的时候有问题

Open SheldonWatson opened this issue 7 years ago • 12 comments

选择完一个月份的天数之后到另外一个月份选择天数的时候,每点击一下都会跳转到第一次选择的月份

SheldonWatson avatar Jan 26 '18 03:01 SheldonWatson

你是怎么调用的?具体参数如何?

jinzhe avatar Jan 29 '18 05:01 jinzhe

我也遇到这个问题,想改源码不知道怎么改,作者帮助一下吧

DylightChen avatar Jan 30 '18 07:01 DylightChen

你是范围选择还是多选啊? 我是用的范围选择,也有过类似的问题,你打印一下选择的日期看看,在月份上加一就OK啦~ 我是这样做的 不知道你适不适用

Momoko7 avatar Feb 28 '18 05:02 Momoko7

我用多选也有同样的问题,看了下代码,应该是每当值变化以后,都重新调用了一次init。

        watch:{
            events(){
                this.render(this.year,this.month)
            },
            value(){
//                this.init();
            }
        },

把这一段代码注释掉就好了

lennie-li avatar Mar 13 '18 10:03 lennie-li

我把这个项目,拉倒我的项目中 怎么就报render 函数 is not function

Live-forever avatar Mar 21 '18 04:03 Live-forever

template or render function not defined

Live-forever avatar Mar 21 '18 04:03 Live-forever

老铁们, 你们都是怎么用的 啊, 我是把calendar.js, 和calendar.vue copy 到项目里去了, 再把 calendar 引入到我要用的地方 然后 他就报template or render function not defined , 请问 我这样用 有毛病 吗 ? 在线等......

Live-forever avatar Mar 21 '18 04:03 Live-forever

楼上的朋友,你是引入组件后没有声明组件吧?看一下vue文档的components

lennie-li avatar Mar 21 '18 11:03 lennie-li

注册了, 但是没用, 现在已经换了一个 vue-calendar-component 组件,

Live-forever avatar Mar 21 '18 11:03 Live-forever

如果没注册, 应该报的是 calendar components is not register, 老铁

Live-forever avatar Mar 21 '18 11:03 Live-forever

哥们儿解决了吗?我是在所需页面直接import的,(import calendar from './calendar.vue') 还有calender的js和vue文件是放在同一个目录下的。。。。

Momoko7 avatar Mar 22 '18 09:03 Momoko7

init

     if (this.value.length > 0) {
       ....
     }
+     if (this.multi) {
+        this.multiDays = this.value.slice()
+     }
     this.render(this.year, this.month)

render

        else if (this.multi) {
          //多选
          let options
          // 判断是否选中
          if (
-            this.value.filter(v => { 
+            this.multiDays.filter(v => {
              return (
                this.year === v[0] && this.month === v[1] - 1 && i === v[2]
              )
            }).length > 0
          ) {

我是这样改的

leat14536 avatar Aug 20 '18 10:08 leat14536