Kaynağa Gözat

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/scene_wisdom

xzw 4 yıl önce
ebeveyn
işleme
3e7eb27fac
1 değiştirilmiş dosya ile 8 ekleme ve 8 silme
  1. 8 8
      js/lib/sys-calendar.js

+ 8 - 8
js/lib/sys-calendar.js

@@ -8,6 +8,7 @@
 var Calendar = function (element, options) {
 
     this.el = $(element);
+    this.el.empty()
     this.options = $.extend(true, {}, this.options, options);
     this.init();
 }
@@ -80,14 +81,14 @@ Calendar.prototype = {
 		},
         //绑定事件
         //changeMode
-        el.on("click", ".calendar-mode-select .btn", function (e) {
+        el.off("click", ".calendar-mode-select .btn").on("click", ".calendar-mode-select .btn", function (e) {
             e.stopPropagation();
             var modeText = $(this).text();
             var mode = modeText == "月" ? "month" : "year";
             me.changeMode(mode);
         })
         //calendar-cell日期点击事件
-        el.on("click", ".calendar-cell", function (e) {
+        el.off("click", ".calendar-cell").on("click", ".calendar-cell", function (e) {
             e.stopPropagation();
             $(".dropdown-month").removeClass("open");
             $(".dropdown-year").removeClass("open");
@@ -127,11 +128,10 @@ Calendar.prototype = {
         })
 
         //年份下拉
-        el.on("click", ".calendar-year-select", function (e) {
+        el.off("click", ".calendar-year-select").on("click", ".calendar-year-select", function (e) {
             e.stopPropagation();
             var eve=me.eve(e);
         	var parent= eve.parentNode;
-            console.log($(parent));
             $(parent).find(".dropdown-month").removeClass("open");
             $(parent).find(".dropdown-year").toggleClass("open");
             //创建下拉数据
@@ -151,7 +151,7 @@ Calendar.prototype = {
             me.el.find(".dropdown-year").html(s);
         })
         //年份改变
-        el.on("click", ".year-item", function (e) {
+        el.off("click", ".year-item").on("click", ".year-item", function (e) {
         	var eve=me.eve(e);
             var parent= eve.parentNode.parentNode.parentNode;
         	var cycleData=null;
@@ -168,7 +168,7 @@ Calendar.prototype = {
 
         })
         //触发选择月份
-        el.on("click", ".calendar-month-select", function (e) {
+        el.off("click", ".calendar-month-select").on("click", ".calendar-month-select", function (e) {
             e.stopPropagation();
             var eve=me.eve(e);
             var parent= eve.parentNode;
@@ -176,7 +176,7 @@ Calendar.prototype = {
             $(parent).find(".dropdown-month").toggleClass("open");
         })
         //月份check事件
-        el.on("click", ".month-item", function (e) {
+        el.off("click", ".month-item").on("click", ".month-item", function (e) {
         	var eve=me.eve(e);
             var parent= eve.parentNode.parentNode;
             e.stopPropagation();
@@ -196,7 +196,7 @@ Calendar.prototype = {
             $(parent).find(".calendar-month-text").text(monthText);
 
         })
-        $(document.body).on("click", function (e) {
+        $(document.body).off("click").on("click", function (e) {
             $(".dropdown-month").removeClass("open");
             $(".dropdown-year").removeClass("open");
         })