{"id":1880,"date":"2024-11-10T09:02:06","date_gmt":"2024-11-10T01:02:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/1880\/"},"modified":"2024-11-10T09:02:06","modified_gmt":"2024-11-10T01:02:06","slug":"%e4%b8%ba%e4%bb%80%e4%b9%88%e4%bd%bf%e7%94%a8num%e5%8f%98%e9%87%8f%e6%97%b6%ef%bc%8c%e6%97%a5%e5%8e%86%e8%a1%a8%e6%97%a0%e6%b3%95%e6%ad%a3%e5%b8%b8%e6%98%be%e7%a4%ba%e6%97%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/1880\/","title":{"rendered":"\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\uff0c\u65e5\u5386\u8868\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u65e5\u671f\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173060929652095.jpg\" class=\"aligncenter\" title=\"\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\uff0c\u65e5\u5386\u8868\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u65e5\u671f\uff1f\u63d2\u56fe\" alt=\"\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\uff0c\u65e5\u5386\u8868\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u65e5\u671f\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u7591\u95ee\uff1a\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\u51fa\u73b0\u95ee\u9898\uff1f<\/strong><\/p>\n<p><strong>\u95ee\u9898\u63cf\u8ff0\uff1a<\/strong><\/p>\n<p>\u5728\u901a\u8fc7\u70b9\u51fb\u201c\u2228\u201d\u6309\u94ae\u589e\u52a0\u65e5\u5386\u8868\u65f6\uff0c\u5e0c\u671b\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u6765\u66ff\u6362\u56fe\u7247\u4e2d\u7684\u6570\u5b57\uff0c\u4f46\u8fd9\u6837\u64cd\u4f5c\u540e\u4f1a\u51fa\u73b0\u5f02\u5e38\uff0c\u5bfc\u81f4\u65e5\u671f\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790\uff1a<\/strong><\/p>\n<p>\u521d\u59cb\u5316\u6267\u884c\u65f6\uff0c\u201cnum\u201d\u4e3a\u672a\u5b9a\u4e49\uff0c\u56e0\u6b64\u201cmonth_now + 1 + num\u201d\u7684\u503c\u4e3aNaN\uff0c\u5bfc\u81f4\u9875\u9762\u4e0d\u663e\u793a\u65e5\u671f\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p>\u76ee\u524d\u7684\u505a\u6cd5\u662f\u70b9\u51fb\u6309\u94ae\u65f6\u4ec5\u8ba9\u201cnum\u201d\u6bcf\u6b21\u589e\u52a01\uff0c\u4f46\u9700\u8981\u91cd\u65b0\u6267\u884c\u62fc\u63a5\u65e5\u671f\u7684\u4ee3\u7801\u624d\u80fd\u66f4\u65b0\u9875\u9762\u4e0a\u7684\u65e5\u671f\u3002<\/p>\n<p><strong>\u4fee\u6539\u540e\u7684\u4ee3\u7801\u6bb5\uff1a<\/strong><\/p>\n<p>\u5728\u4ee5\u4e0b\u4ee3\u7801\u5757\u4e2d\uff0c\u52a0\u5165\u4e86\u5bf9\u62fc\u63a5\u65e5\u671f\u4ee3\u7801\u7684\u91cd\u65b0\u6267\u884c\uff1a<\/p>\n<pre>\/\/\u83b7\u53d6\u2018\u2228\u2019\u7684\u70b9\u51fb\u6b21\u6570\n$('&lt;button class=add_cla&gt;\u2228&lt;\/button&gt;').appendTo('body')\n$('.add_cla').addClass('add_sty')\nfunction add_month(callback) {\n    var num_next = 0;\n    $('.add_cla').click(function () {\n        callback(num_next++)\n        \/\/ \u62fc\u63a5\u65e5\u671f\u4ee3\u7801\u6267\u884c\n        var html = '&lt;div class=\"box\"&gt;';\n\n        \/\/\u83b7\u53d6\u6bcf\u4e2a\u6708\u4efd\u5171\u6709\u591a\u5c11\u5929\n        var max = new Date(year, m, 0).getDate();\n        html += '&lt;tr&gt;';\/\/\u5f00\u59cb&lt;tr \u6807\u7b7e\n        for (d = 1; d &lt;= max; d++) {\n            if (w &amp;&amp; d == 1) {\/\/\u5982\u679c\u8be5\u6708\u7684\u7b2c1\u5929\u4e0d\u662f\u661f\u671f\u65e5\uff0c\u5219\u586b\u5145\u7a7a\u767d\n                html += '&lt;td colspan =\"' + w + '\" &gt; &lt;\/td&gt;'; \/\/\u53d8\u91cf\u52a0\u5165\u5b57\u7b26\u4e32\n            }\n            html += '&lt;td class=\"td_event\" id=td_id' + d + '&gt;' + d + '&lt;\/td&gt;';\n            if (w == 6 &amp;&amp; d != max) {\/\/\u5982\u679c\u661f\u671f\u516d\u4e0d\u662f\u8be5\u6708\u7684\u6700\u540e\u4e00\u5929\uff0c\u5219\u6362\u884c\n                html += '&lt;\/tr&gt;&lt;tr&gt;';\n            } else if (d == max) {\/\/\u8be5\u6708\u7684\u6700\u540e\u4e00\u5929\uff0c\u95ed\u5408&lt;\/tr \u6807\u7b7e\n                html += '&lt;\/tr&gt;';\n            }\n            w = (w + 1 &gt; 6) ? 0 : w + 1;\n        }\n       ......<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u901a\u8fc7\u91cd\u65b0\u6267\u884c\u62fc\u63a5\u65e5\u671f\u7684\u4ee3\u7801\uff0c\u6bcf\u6b21\u201cnum\u201d\u53d8\u5316\u65f6\u90fd\u4f1a\u6b63\u786e\u66f4\u65b0\u9875\u9762\u4e0a\u7684\u65e5\u671f\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\uff0c\u65e5\u5386\u8868\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u65e5\u671f\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7591\u95ee\uff1a\u4e3a\u4ec0\u4e48\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u65f6\u51fa\u73b0\u95ee\u9898\uff1f \u95ee\u9898\u63cf\u8ff0\uff1a \u5728\u901a\u8fc7\u70b9\u51fb\u201c\u2228\u201d\u6309\u94ae\u589e\u52a0\u65e5\u5386\u8868\u65f6\uff0c\u5e0c\u671b\u4f7f\u7528\u201cnum\u201d\u53d8\u91cf\u6765\u66ff\u6362\u56fe\u7247\u4e2d\u7684\u6570\u5b57\uff0c\u4f46\u8fd9\u6837\u64cd\u4f5c\u540e\u4f1a\u51fa\u73b0\u5f02\u5e38\uff0c\u5bfc\u81f4\u65e5\u671f\u65e0\u6cd5\u6b63\u5e38\u663e\u793a\u3002 \u539f\u56e0\u5206\u6790\uff1a \u521d\u59cb\u5316\u6267\u884c\u65f6\uff0c\u201cnum\u201d\u4e3a\u672a\u5b9a\u4e49\uff0c\u56e0\u6b64\u201cmonth_now + 1 + num\u201d\u7684\u503c\u4e3aNaN\uff0c\u5bfc\u81f4\u9875\u9762\u4e0d\u663e\u793a\u65e5\u671f\u3002 \u89e3\u51b3\u65b9\u6848\uff1a \u76ee\u524d\u7684\u505a\u6cd5\u662f\u70b9\u51fb\u6309\u94ae\u65f6\u4ec5\u8ba9\u201cnum\u201d\u6bcf\u6b21\u589e\u52a01\uff0c\u4f46\u9700\u8981\u91cd\u65b0\u6267\u884c\u62fc\u63a5\u65e5\u671f\u7684\u4ee3\u7801\u624d\u80fd\u66f4\u65b0\u9875\u9762\u4e0a\u7684\u65e5\u671f\u3002 \u4fee\u6539\u540e\u7684\u4ee3\u7801\u6bb5\uff1a \u5728\u4ee5\u4e0b\u4ee3\u7801\u5757\u4e2d\uff0c\u52a0\u5165\u4e86\u5bf9\u62fc\u63a5\u65e5\u671f\u4ee3\u7801\u7684\u91cd\u65b0\u6267\u884c\uff1a \/\/\u83b7\u53d6\u2018\u2228\u2019\u7684\u70b9\u51fb\u6b21\u6570 $(&#8216;&lt;button class=add_cla&gt;\u2228&lt;\/button&gt;&#8217;).appendTo(&#8216;body&#8217;) $(&#8216;.add_cla&#8217;).addClass(&#8216;add_sty&#8217;) function add_month(callback) { var num_next = 0; $(&#8216;.add_cla&#8217;).click(function () { callback(num_next++) \/\/ \u62fc\u63a5\u65e5\u671f\u4ee3\u7801\u6267\u884c var html = &#8216;&lt;div class=&#8221;box&#8221;&gt;&#8217;; \/\/\u83b7\u53d6\u6bcf\u4e2a\u6708\u4efd\u5171\u6709\u591a\u5c11\u5929 var max = new Date(year, m, 0).getDate(); html += &#8216;&lt;tr&gt;&#8217;;\/\/\u5f00\u59cb&lt;tr \u6807\u7b7e for (d = 1; d &lt;= max; d++) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-1880","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=1880"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/1880\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=1880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=1880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=1880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}