{"id":32397,"date":"2024-11-25T15:52:41","date_gmt":"2024-11-25T07:52:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/32397\/"},"modified":"2024-11-25T15:52:41","modified_gmt":"2024-11-25T07:52:41","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%ae%9e%e4%be%8b%ef%bc%9a%e5%ae%9e%e7%8e%b03d%e8%bd%ae%e6%92%ad%e5%9b%be%e7%89%b9%e6%95%88%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/32397\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801"},"content":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u5185\u5bb9\u662f\u5173\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03d\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801\uff0c\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<p>\u5728\u5199\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u65f6\uff0c\u6709\u5199\u5230\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7684\u6548\u679c\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u81ea\u5e26\u7684\u7ec4\u4ef6swiper\u6765\u5b9e\u73b0<\/p>\n<p>\u6548\u679c\u56fe\u5982\u4e0b\uff1a<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/\/upload\/image\/794\/938\/475\/1535506672352282.png\" class=\"aligncenter\" title=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801\u63d2\u56fe\" alt=\"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801\u63d2\u56fe\" \/><\/p>\n<h1><span style=\"font-size: 18px\">1.swiper\u7684\u76f8\u5173\u5c5e\u6027<\/span><\/h1>\n<p>indicator-dots \u662f\u5426\u663e\u793a\u5c0f\u5706\u70b9\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5df1\u91cd\u65b0\u8bbe\u7f6e\u5c0f\u5706\u70b9<\/p>\n<p>circular \u662f\u5426\u8854\u63a5\u6ed1\u52a8\uff0c\u5c31\u662f\u5b9e\u73b0\u65e0\u9650\u6eda\u52a8<\/p>\n<p>previous-margin \u4e0e\u4e0a\u4e00\u5f20\u56fe\u7247\u7684\u95f4\u8ddd<\/p>\n<p>next-margin \u4e0e\u4e0b\u4e00\u5f20\u56fe\u7247\u7684\u95f4\u8ddd<\/p>\n<p>autoplay \u5b9e\u73b0\u81ea\u52a8\u6eda\u52a8<\/p>\n<p>\u8fd9\u91cc\u4e3b\u8981\u5229\u7528\u4e86circular\u5b9e\u73b0\u65e0\u9650\u6eda\u52a8\uff0c\u7136\u540e\u518d\u52a0\u4e0a\u524d\u540e\u95f4\u8ddd\uff0c\u518d\u8bbe\u7f6e\u56fe\u7247\u7684\u5c42\u7ea7\u548c\u900f\u660e\u5ea6\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86,\u5c06\u56fe\u7247\u53ca\u5bb9\u5668\u7684\u9ad8\u5ea6\u8bbe\u7f6e\u597d\u5c31\u5dee\u4e0d\u591a\u53ef\u4ee5\u5b9e\u73b0\u4e86 <\/p>\n<p>wxml\u6587\u4ef6<\/p>\n<pre>&lt;!--carousel\/index.wxml--&gt;\n&lt;swiper class=\"imageContainer\" bindchange=\"handleChange\" previous-margin=\"50rpx\" next-margin=\"50rpx\" circular autoplay&gt;\n  &lt;block wx:for=\"{{3}}\" wx:key=\"{{index}}\"&gt;\n    &lt;swiper-item class=\"item\"&gt;\n      &lt;image class=\"itemImg {{currentIndex == index ? 'active': ''}}\" src=\"..\/..\/..\/image\/3.jpg\"&gt;&lt;\/image&gt;\n    &lt;\/swiper-item&gt;\n  &lt;\/block&gt;\n&lt;\/swiper&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>wxss\u6587\u4ef6<\/p>\n<pre>\/* carousel\/index.wxss *\/\npage{\n  background: #f7f7f7f7;\n}\n.imageContainer{\n  width: 100%;\n  height: 500rpx;\n  background: #000;\n}\n.item{\n  height: 500rpx;\n}\n.itemImg{\n  position: absolute;\n  width: 100%;\n  height: 380rpx;\n  border-radius: 15rpx;\n  z-index: 5;\n  opacity: 0.7;\n  top: 13%;\n}\n.active{\n  opacity: 1;\n  z-index: 10;\n  height: 430rpx;\n  top: 7%;\n  transition:all .2s ease-in 0s;\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>JS\u6587\u4ef6<\/p>\n<pre>\/\/ carousel\/index.js\nPage({\n\n  data: {\n    currentIndex: 0\n  },\n\n  onLoad: function (options) {\n  \n  },\n  \/* \u8fd9\u91cc\u5b9e\u73b0\u63a7\u5236\u4e2d\u95f4\u51f8\u663e\u56fe\u7247\u7684\u6837\u5f0f *\/\n  handleChange: function(e) {\n    this.setData({\n      currentIndex: e.detail.current\n    })\n  },\n})<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u76f8\u5173\u63a8\u8350\uff1a<\/p>\n<p><\/p>\n<p><\/p>\n<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801\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\u7bc7\u6587\u7ae0\u7ed9\u5927\u5bb6\u5e26\u6765\u7684\u5185\u5bb9\u662f\u5173\u4e8e\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u5b9e\u4f8b\uff1a\u5b9e\u73b03d\u8f6e\u64ad\u56fe\u7279\u6548\u4ee3\u7801\uff0c\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u6709\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e00\u4e0b\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002 \u5728\u5199\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u65f6\uff0c\u6709\u5199\u5230\u5b9e\u73b03D\u8f6e\u64ad\u56fe\u7684\u6548\u679c\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e2d\u81ea\u5e26\u7684\u7ec4\u4ef6swiper\u6765\u5b9e\u73b0 \u6548\u679c\u56fe\u5982\u4e0b\uff1a 1.swiper\u7684\u76f8\u5173\u5c5e\u6027 indicator-dots \u662f\u5426\u663e\u793a\u5c0f\u5706\u70b9\uff0c\u4e5f\u53ef\u4ee5\u81ea\u5df1\u91cd\u65b0\u8bbe\u7f6e\u5c0f\u5706\u70b9 circular \u662f\u5426\u8854\u63a5\u6ed1\u52a8\uff0c\u5c31\u662f\u5b9e\u73b0\u65e0\u9650\u6eda\u52a8 previous-margin \u4e0e\u4e0a\u4e00\u5f20\u56fe\u7247\u7684\u95f4\u8ddd next-margin \u4e0e\u4e0b\u4e00\u5f20\u56fe\u7247\u7684\u95f4\u8ddd autoplay \u5b9e\u73b0\u81ea\u52a8\u6eda\u52a8 \u8fd9\u91cc\u4e3b\u8981\u5229\u7528\u4e86circular\u5b9e\u73b0\u65e0\u9650\u6eda\u52a8\uff0c\u7136\u540e\u518d\u52a0\u4e0a\u524d\u540e\u95f4\u8ddd\uff0c\u518d\u8bbe\u7f6e\u56fe\u7247\u7684\u5c42\u7ea7\u548c\u900f\u660e\u5ea6\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86,\u5c06\u56fe\u7247\u53ca\u5bb9\u5668\u7684\u9ad8\u5ea6\u8bbe\u7f6e\u597d\u5c31\u5dee\u4e0d\u591a\u53ef\u4ee5\u5b9e\u73b0\u4e86 wxml\u6587\u4ef6 &lt;!&#8211;carousel\/index.wxml&#8211;&gt; &lt;swiper class=&#8221;imageContainer&#8221; bindchange=&#8221;handleChange&#8221; previous-margin=&#8221;50rpx&#8221; next-margin=&#8221;50rpx&#8221; circular autoplay&gt; &lt;block wx:for=&#8221;{{3}}&#8221; wx:key=&#8221;{{index}}&#8221;&gt; &lt;swiper-item class=&#8221;item&#8221;&gt; &lt;image class=&#8221;itemImg {{currentIndex == index ? &#8216;active&#8217;: &#8221;}}&#8221; src=&#8221;..\/..\/..\/image\/3.jpg&#8221;&gt;&lt;\/image&gt; &lt;\/swiper-item&gt; &lt;\/block&gt; &lt;\/swiper&gt; \u767b\u5f55\u540e\u590d\u5236 wxss\u6587\u4ef6 \/* carousel\/index.wxss *\/ page{ background: #f7f7f7f7; } .imageContainer{ width: 100%; height: 500rpx; [&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-32397","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32397","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=32397"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/32397\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=32397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=32397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=32397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}