{"id":31353,"date":"2024-11-25T12:37:12","date_gmt":"2024-11-25T04:37:12","guid":{"rendered":"https:\/\/fwq.ai\/blog\/31353\/"},"modified":"2024-11-25T12:37:12","modified_gmt":"2024-11-25T04:37:12","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e9%80%89%e9%a1%b9%e5%8d%a1%e5%8a%9f%e8%83%bd%e7%9a%84%e5%bc%80%e5%8f%91","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/31353\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1"},"content":{"rendered":"<p>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u5206\u4eab\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6<\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span style=\"font-size:18px;color:#333333\"><span style=\"letter-spacing:.2px\">\u5728pages\u6587\u4ef6\u91cc\u9762\u521b\u5efaswipertab\u6587\u4ef6\u5939<\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><span style=\"letter-spacing:.2px\">1.\u7f16\u5199\u9875\u9762\u7ed3\u6784:<\/span>swipertab.wxml<\/span><\/span><\/p>\n<pre>&lt;!--swipertab.wxml--&gt;\r\n&lt;view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e00&lt;\/view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e8c&lt;\/view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e09&lt;\/view&gt;&nbsp;&nbsp;\r\n&lt;\/view&gt;&nbsp;&nbsp;\r\n&lt;swiper&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- tab\u4e00 --&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e00&lt;\/view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- tab\u4e8c --&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e8c&lt;\/view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- tab\u4e09 --&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e09&lt;\/view&gt;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp;\r\n&lt;\/swiper&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><span style=\"letter-spacing:.2px\">2.<\/span><span style=\"letter-spacing:.2px\">\u8bbe\u7f6e\u6570\u636e:swipertab.js<\/span><\/span><\/span><\/p>\n<pre>\/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b&nbsp;&nbsp;\r\nvar&nbsp;app&nbsp;=&nbsp;getApp()\r\nPage({\r\n\tdata:&nbsp;{\r\n\t\t\/**&nbsp;\r\n\t\t&nbsp;*&nbsp;\u9875\u9762\u914d\u7f6e\r\n\t\t&nbsp;*\/\r\n\t\twinWidth:&nbsp;0,\r\n\t\twinHeight:&nbsp;0,\r\n\t\t\/\/&nbsp;tab\u5207\u6362&nbsp;&nbsp;\r\n\t\tcurrentTab:&nbsp;0,\r\n\t},\r\n\tonLoad:&nbsp;function()&nbsp;{\r\n\t\tvar&nbsp;that&nbsp;=&nbsp;this;\r\n\r\n\t\t\/**&nbsp;\r\n\t\t&nbsp;*&nbsp;\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f\r\n\t\t&nbsp;*\/\r\n\t\twx.getSystemInfo({\r\n\r\n\t\t\tsuccess:&nbsp;function(res)&nbsp;{\r\n\t\t\t\tthat.setData({\r\n\t\t\t\t\twinWidth:&nbsp;res.windowWidth,\r\n\t\t\t\t\twinHeight:&nbsp;res.windowHeight\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t},\r\n\t\/**&nbsp;\r\n\t&nbsp;*&nbsp;\u6ed1\u52a8\u5207\u6362tab\r\n\t&nbsp;*\/\r\n\tbindChange:&nbsp;function(e)&nbsp;{\r\n\r\n\t\tvar&nbsp;that&nbsp;=&nbsp;this;\r\n\t\tthat.setData({\r\n\t\t\tcurrentTab:&nbsp;e.detail.current\r\n\t\t});\r\n\r\n\t},\r\n\t\/**&nbsp;\r\n\t&nbsp;*&nbsp;\u70b9\u51fbtab\u5207\u6362\r\n\t&nbsp;*\/\r\n\tswichNav:&nbsp;function(e)&nbsp;{\r\n\r\n\t\tvar&nbsp;that&nbsp;=&nbsp;this;\r\n\r\n\t\tif&nbsp;(this.data.currentTab&nbsp;===&nbsp;e.target.dataset.current)&nbsp;{\r\n\t\t\treturn&nbsp;false;\r\n\t\t}&nbsp;else&nbsp;{\r\n\t\t\tthat.setData({\r\n\t\t\t\tcurrentTab:&nbsp;e.target.dataset.current\r\n\t\t\t})\r\n\t\t}\r\n\t}\r\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span><span style=\"font-size:18px;color:#333333\">3.\u8bbe\u7f6e\u6837\u5f0f:swipertab.wxss<\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><\/span><\/span><\/p>\n<pre>.swiper-tab{&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;width:&nbsp;100%;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;border-bottom:&nbsp;2rpx&nbsp;solid&nbsp;#777777;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;text-align:&nbsp;center;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;line-height:&nbsp;80rpx;}&nbsp;&nbsp;\r\n.swiper-tab-list{&nbsp;&nbsp;font-size:&nbsp;30rpx;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;display:&nbsp;inline-block;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;width:&nbsp;33.33%;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;color:&nbsp;#777777;&nbsp;&nbsp;\r\n}&nbsp;&nbsp;\r\n.on{&nbsp;color:&nbsp;#da7c0c;&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;border-bottom:&nbsp;5rpx&nbsp;solid&nbsp;#da7c0c;}&nbsp;&nbsp;\r\n&nbsp;&nbsp;\r\n.swiper-box{&nbsp;display:&nbsp;block;&nbsp;height:&nbsp;100%;&nbsp;width:&nbsp;100%;&nbsp;overflow:&nbsp;hidden;&nbsp;}&nbsp;&nbsp;\r\n.swiper-box&nbsp;view{&nbsp;&nbsp;\r\n&nbsp;&nbsp;&nbsp;&nbsp;text-align:&nbsp;center;&nbsp;&nbsp;\r\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><span style=\"font-family:\">4.\u5934\u90e8\u6807\u9898\u4fee\u6539:swipertab.json<\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><\/span><\/span><\/p>\n<pre>{\r\n&nbsp;&nbsp;&nbsp;&nbsp;\"navigationBarTitleText\":&nbsp;\"\u9009\u9879\u5361\u9875\u9762\u5207\u6362\"\r\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\">5.\u6548\u679c\u56fe<\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/4aaf7fa23738468c57550aab5f36e0a9-0.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\u63d2\u56fe\" \/><\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><br \/><\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\">\u6ce8\u610f\uff1a\u56e0\u4e3a\u6587\u4ef6\u540d\u4e0d\u662findex,\u6240\u4ee5\u8bb0\u5f97\u4fee\u6539app.json\u6587\u4ef6(\u5e95\u4e0b\u5907\u6ce8\u7684\u5730\u65b9)\uff0c\u5426\u5219\u9875\u9762\u4e0d\u4f1a\u663e\u793a\u540c\u65f6\u5e95\u90e8\u4e0d\u4f1a\u663e\u793a<\/span><\/span><\/p>\n<p style=\"margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px\"><span><span style=\"font-size:18px;color:#333333\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/054\/025\/4aaf7fa23738468c57550aab5f36e0a9-1.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\u63d2\u56fe1\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\u63d2\u56fe1\" \/><br \/><\/span><\/span><\/p>\n<p style=\"margin-top: 0px;margin-bottom: 0px;padding-top: 0px;padding-bottom: 0px\">\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p style=\"margin-top: 0px;margin-bottom: 0px;padding-top: 0px;padding-bottom: 0px\">\n<p style=\"margin-top: 0px;margin-bottom: 0px;padding-top: 0px;padding-bottom: 0px\">\n<p style=\"margin-top: 0px;margin-bottom: 0px;padding-top: 0px;padding-bottom: 0px\">\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\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>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u5206\u4eab\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u9009\u9879\u5361\u529f\u80fd\u7684\u5f00\u53d1\uff0c\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6 \u5728pages\u6587\u4ef6\u91cc\u9762\u521b\u5efaswipertab\u6587\u4ef6\u5939 1.\u7f16\u5199\u9875\u9762\u7ed3\u6784:swipertab.wxml &lt;!&#8211;swipertab.wxml&#8211;&gt; &lt;view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e00&lt;\/view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e8c&lt;\/view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e09&lt;\/view&gt;&nbsp;&nbsp; &lt;\/view&gt;&nbsp;&nbsp; &lt;swiper&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211; tab\u4e00 &#8211;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e00&lt;\/view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211; tab\u4e8c &#8211;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e8c&lt;\/view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;!&#8211; tab\u4e09 &#8211;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;swiper-item&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;view&gt;tab\u4e09&lt;\/view&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&lt;\/swiper-item&gt;&nbsp;&nbsp; &lt;\/swiper&gt; \u767b\u5f55\u540e\u590d\u5236 2.\u8bbe\u7f6e\u6570\u636e:swipertab.js \/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b&nbsp;&nbsp; var&nbsp;app&nbsp;=&nbsp;getApp() Page({ data:&nbsp;{ \/**&nbsp; &nbsp;*&nbsp;\u9875\u9762\u914d\u7f6e &nbsp;*\/ winWidth:&nbsp;0, winHeight:&nbsp;0, \/\/&nbsp;tab\u5207\u6362&nbsp;&nbsp; currentTab:&nbsp;0, }, onLoad:&nbsp;function()&nbsp;{ var&nbsp;that&nbsp;=&nbsp;this; \/**&nbsp; &nbsp;*&nbsp;\u83b7\u53d6\u7cfb\u7edf\u4fe1\u606f &nbsp;*\/ wx.getSystemInfo({ success:&nbsp;function(res)&nbsp;{ that.setData({ winWidth:&nbsp;res.windowWidth, winHeight:&nbsp;res.windowHeight }); } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-31353","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31353","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=31353"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/31353\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=31353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=31353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=31353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}