{"id":1152,"date":"2023-03-11T16:59:00","date_gmt":"2023-03-11T08:59:00","guid":{"rendered":"http:\/\/blog.xrhoujie.com\/?p=1152"},"modified":"2023-03-20T17:09:26","modified_gmt":"2023-03-20T09:09:26","slug":"vue-swipe3d%e7%bb%84%e4%bb%b6%e5%b0%81%e8%a3%85","status":"publish","type":"post","link":"http:\/\/blog.xrhoujie.com\/?p=1152","title":{"rendered":"vue-swipe3d\u7ec4\u4ef6\u5c01\u88c5"},"content":{"rendered":"\n<p>\u524d\u6bb5\u65f6\u95f4\u505a\u4e86\u4e00\u4e2aweb\u5c0f\u7a0b\u5e8f\u9879\u76ee\uff0c\u4e1a\u52a1\u4e0a\u67093d\u8f6e\u64ad\u9700\u6c42\uff0c\u6240\u4ee5\u54b1\u5c31\u5f00\u59cb\u52a8\u624b\u62c6\u5206-\u5c01\u88c5\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" src=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image.png\" alt=\"\" class=\"wp-image-1153\" width=\"354\" height=\"173\" srcset=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image.png 583w, http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image-300x147.png 300w\" sizes=\"(max-width: 354px) 100vw, 354px\" \/><\/figure>\n\n\n\n<p>\u6548\u679c\u56fe\uff1a<\/p>\n\n\n\n<ul><li><strong>\u5b89\u88c5<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -S vue-carousel-3d<\/code><\/pre>\n\n\n\n<ul><li><strong>\u5f15\u5165<\/strong><\/li><\/ul>\n\n\n\n<p>\u5728main.js\u5168\u5c40\u5f15\u5165\uff1a&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import Carousel3d from 'vue-carousel-3d';\nVue.use(Carousel3d);<\/code><\/pre>\n\n\n\n<ul><li>\u4f7f\u7528<\/li><\/ul>\n\n\n\n<p>\u7236\u7ec4\u4ef6:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=\"swiper-box\">\n   &lt;carousel-3d\n     class=\"swiper-item\"\n     :autoplay=\"true\"\n\t:autoplayTimeout=\"3000\"\n\t:perspective=\"5\"\n\t:display=\"5\"\n\t:animationSpeed=\"1000\"\n\t:width=\"146\"\n\t:height=\"186\"\n\t:controlsVisib=\"false\"\n\t:inverseScaling=\"10\"\t\n\tspace=\"160\"\n     >\n\t&lt;slide v-for=\"(item, i) in slides\" :index=\"i\" :key=\"i\">\n\t   &lt;template slot-scope=\"obj\">\n\t\t&lt;img :src=\"item.src\" @click=\"imgClick(item,obj)\" \/>\n\t    &lt;\/template>\n\t&lt;\/slide>\n\t&lt;\/carousel-3d>\n&lt;\/div>\n\n&lt;script>\n\nimport { Carousel3d, Slide } from 'vue-carousel-3d'\t\n\nexport default {\n      components:{\n\t   Carousel3d,\n \u3000\u3000       Slide,\n      },\n}\ndata() {\n\treturn {\t\n\tslides: &#91;\n\t {\n\t\ttitle: 'parent',\n\t\tslide: 23424234234234,\n\t\t src: \"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2017\/04\/js-768x461.png\"\n\t },\n\t {\n\t\ttitle: 'parent',\n\t\tslide: 23424234234234,\n\t\tsrc: \"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2017\/10\/background-768x461.png\"\n        },\n\t{\n\t\ttitle: 'parent',\n\t\tslide: 23424234234234,\n\t\tsrc: \"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2017\/04\/create-768x461.png\"\n\t\t}],\n\t\t};\n\t},\n\nmethods: {\n    imgClick(data,obj) {\n      console.log(data,obj)\n    }\n  }\n\n&lt;\/script>\n\n\n\n&lt;style lang=\"scss\" scoped>\n\t.swiper-box {\n\t\tposition: relative;\n\t\twidth: 100%;\n\t\theight: 186px;\n\t}\n\t.swiper-item {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tmargin:0px;\n\t}\n\t.swiper-item img {\n\t\twidth: 100%;\n\t\theight: 186px;\n\t}\n&lt;\/style>\n\n\n\n<\/code><\/pre>\n\n\n\n<p>\u770b\u770b\u6587\u6863\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"978\" height=\"835\" src=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image-2.png\" alt=\"\" class=\"wp-image-1155\" srcset=\"http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image-2.png 978w, http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image-2-300x256.png 300w, http:\/\/blog.xrhoujie.com\/wp-content\/uploads\/2023\/03\/image-2-768x656.png 768w\" sizes=\"(max-width: 978px) 100vw, 978px\" \/><\/figure>\n\n\n\n<p>\u7167\u7740\u8c03\u5c31\u662f\u4e86 \uff0c\u86ee\u7b80\u5355\u7684\uff0c\u6548\u679c\u4e5f\u5f88\u597d\uff0c\u5728h5\uff0capp\uff0c\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u90fd\u6709\u826f\u597d\u7684\u6548\u679c\u3002\u63a8\u8350<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u6bb5\u65f6\u95f4\u505a\u4e86\u4e00\u4e2aweb\u5c0f\u7a0b\u5e8f\u9879\u76ee\uff0c\u4e1a\u52a1\u4e0a\u67093d\u8f6e\u64ad\u9700\u6c42\uff0c\u6240\u4ee5\u54b1\u5c31\u5f00\u59cb\u52a8\u624b\u62c6\u5206-\u5c01\u88c5\u3002 \u6548\u679c\u56fe\uff1a \u5b89\u88c5 \u5f15\u5165 \u5728 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[38],"_links":{"self":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/1152"}],"collection":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1152"}],"version-history":[{"count":1,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/1152\/revisions"}],"predecessor-version":[{"id":1156,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=\/wp\/v2\/posts\/1152\/revisions\/1156"}],"wp:attachment":[{"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1152"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.xrhoujie.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}