{"id":5,"date":"2023-08-02T19:15:18","date_gmt":"2023-08-02T11:15:18","guid":{"rendered":"http:\/\/wh-nbebjsqvkujqouo01kl.my3w.com\/?p=5"},"modified":"2023-08-08T14:56:46","modified_gmt":"2023-08-08T06:56:46","slug":"1","status":"publish","type":"post","link":"https:\/\/xiuxiejiang.com\/index.php\/2023\/08\/02\/1\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8fSwiper\u9ad8\u5ea6\u81ea\u9002\u5e94\u95ee\u9898"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Swiper\u63a7\u4ef6\u65e0\u6cd5\u6839\u636e\u5185\u5bb9\u81ea\u52a8\u8c03\u6574\u9ad8\u5ea6\u3002\u56e0\u6b64\u9700\u8981\u52a8\u6001\u8ba1\u7b97\u9ad8\u5ea6\uff0c\u53d6\u6240\u6709Slide\u4e2d\u9ad8\u5ea6\u6700\u5927\u7684\u4e00\u9875\uff0c\u8d4b\u503c\u7ed9Swiper\u5bf9\u8c61\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5Taro\u6846\u67b6\uff08React\uff09\u4e3a\u4f8b\uff1a<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"js\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">  onUpdateSwiperImage (e) {\n\n    setTimeout(() => {\n      const query = Taro.createSelectorQuery()\n      query\n        .select('.swiper-img')\n        .boundingClientRect()\n        .exec((rectArr) => {\n          if (rectArr.length == 0) return;\n\n          let maxHeight = rectArr[0].height;\n          rectArr.forEach((rect) => {\n            if (rect.height > maxHeight) {\n              maxHeight = rect.height\n            }\n          })\n          this.setState({ swiperHeight: maxHeight })\n\n        })\n    }, 200);\n  }\n\n\n &lt;View className=\"swipper-wrapper\">\n        &lt;View className=\"swipper-inner\">\n          &lt;Swiper\n            autoplay\n            indicatorDots\n            className=\"swiper\"\n            style={{ height: this.state.swiperHeight + 'px' }}\n          >\n            {views}\n          &lt;\/Swiper>\n        &lt;\/View>\n      &lt;\/View><\/pre>\n<\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Swiper\u63a7\u4ef6\u65e0\u6cd5\u6839\u636e\u5185\u5bb9\u81ea\u52a8\u8c03\u6574\u9ad8\u5ea6\u3002\u56e0\u6b64\u9700\u8981\u52a8\u6001\u8ba1\u7b97\u9ad8\u5ea6\uff0c\u53d6&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[3,2],"class_list":["post-5","post","type-post","status-publish","format-standard","hentry","category-minprogram","tag-3","tag-swiper"],"_links":{"self":[{"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/posts\/5","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":6,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"predecessor-version":[{"id":41,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/posts\/5\/revisions\/41"}],"wp:attachment":[{"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xiuxiejiang.com\/index.php\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}