{"id":28907,"date":"2024-11-25T12:42:05","date_gmt":"2024-11-25T04:42:05","guid":{"rendered":"https:\/\/fwq.ai\/blog\/28907\/"},"modified":"2024-11-25T12:42:05","modified_gmt":"2024-11-25T04:42:05","slug":"%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e4%b9%8b%e6%8b%96%e6%8b%bd%e6%8e%92%e5%ba%8f%e7%9a%84%e7%a4%ba%e4%be%8b%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/28907\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e4b\u62d6\u62fd\u6392\u5e8f\u7684\u793a\u4f8b\u4ee3\u7801"},"content":{"rendered":"<p>\u672c\u7bc7\u6587\u7ae0\u4e3b\u8981\u5206\u4eab\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u62d6\u62fd\u6392\u5e8f\u7684\u793a\u4f8b\u4ee3\u7801\u3002\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u4e0b\u9762\u8ddf\u7740\u5c0f\u7f16\u4e00\u8d77\u6765\u770b\u4e0b\u5427<\/p>\n<p>index.wxml<\/p>\n<pre>&lt;!--index.wxml--&gt;\r\n&lt;view&gt;\r\n&nbsp;&lt;view&gt;\r\n&nbsp;&lt;view&gt;{{item.content}}&lt;\/view&gt;\r\n&nbsp;&lt;\/view&gt;&lt;\/view&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>index.<\/p>\n<pre>\/\/index.js\r\n\/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b\r\nvar&nbsp;app&nbsp;=&nbsp;getApp();\r\nvar&nbsp;x,y,x1,y1,x2,y2,index,currindex,n,yy;\r\nvar&nbsp;arr1&nbsp;=&nbsp;[{content:11,id:1},{content:22,id:2},{content:33,id:3},{content:44,id:4},{content:55,id:5}];\r\nPage({\r\n&nbsp;data:&nbsp;{\r\n&nbsp;mainx:0,\r\n&nbsp;content:[{content:11,id:1},{content:22,id:2},{content:33,id:3},{content:44,id:4},{content:55,id:5}],\r\n&nbsp;start:{x:0,y:0}\r\n&nbsp;},\r\n&nbsp;movestart:function(e){\r\n&nbsp;currindex&nbsp;=&nbsp;e.target.dataset.index;\r\n&nbsp;&nbsp;x&nbsp;=&nbsp;e.touches[0].clientX;\r\n&nbsp;&nbsp;y&nbsp;=&nbsp;e.touches[0].clientY;\r\n&nbsp;&nbsp;x1&nbsp;=&nbsp;e.currentTarget.offsetLeft;\r\n&nbsp;&nbsp;y1&nbsp;=&nbsp;e.currentTarget.offsetTop;\r\n&nbsp;},\r\n&nbsp;move:function(e){\r\n&nbsp;yy&nbsp;=&nbsp;e.currentTarget.offsetTop;\r\n&nbsp;x2&nbsp;=&nbsp;e.touches[0].clientX-x+x1;\r\n&nbsp;y2&nbsp;=&nbsp;e.touches[0].clientY-y+y1;\r\n&nbsp;this.setData({\r\n&nbsp;&nbsp;mainx:currindex,\r\n&nbsp;&nbsp;opacity:0.7,\r\n&nbsp;&nbsp;start:{x:x2,y:y2}\r\n&nbsp;})\r\n&nbsp;},\r\n&nbsp;moveend:function(){\r\n&nbsp;if(y2&nbsp;!=&nbsp;0){\r\n&nbsp;&nbsp;var&nbsp;arr&nbsp;=&nbsp;[];\r\n&nbsp;&nbsp;for(var&nbsp;i=0;&nbsp;i&lt;this.data.content.length&gt;(52*(k-1)+k*2-26)){\r\n&nbsp;&nbsp;&nbsp;n=k;\r\n&nbsp;&nbsp;}\r\n&nbsp;&nbsp;}\r\n&nbsp;&nbsp;if(y2&amp;gt;(52*(nx-1)+nx*2-26)){\r\n&nbsp;&nbsp;n&nbsp;=&nbsp;nx;\r\n&nbsp;&nbsp;}\r\n&nbsp;&nbsp;console.log(arr);\r\n&nbsp;&nbsp;console.log(arr1)\r\n&nbsp;&nbsp;arr.splice((currindex-1),1);\r\n&nbsp;&nbsp;arr.splice((n-1),0,arr1[currindex-1]);\r\n&nbsp;&nbsp;arr1&nbsp;=&nbsp;[];\r\n&nbsp;&nbsp;for(var&nbsp;m=0;&nbsp;m&lt;this.data.content.length&gt;&lt;p&gt;index.&lt;a href=\"http:\/\/www.php.cn\/code\/7880.html\" target=\"_blank\"&gt;wxss&lt;\/a&gt;&lt;\/p&gt;\n&lt;pre class=\"brush:xml;toolbar:false\"&gt;.container&nbsp;{\r\n&nbsp;height:&nbsp;100%;\r\n&nbsp;display:&nbsp;flex;\r\n&nbsp;flex-direction:&nbsp;column;\r\n&nbsp;align-items:&nbsp;center;\r\n&nbsp;justify-content:&nbsp;space-between;\r\n&nbsp;padding:&nbsp;200rpx&nbsp;0;\r\n&nbsp;box-sizing:&nbsp;border-box;\r\n}&nbsp;\r\n.box{width:300px;&nbsp;position:&nbsp;relative}\r\n.main{width:&nbsp;90%;&nbsp;height:50px;&nbsp;background:&nbsp;#eee;&nbsp;border:&nbsp;1px&nbsp;solid&nbsp;#ccc;&nbsp;margin:2px&nbsp;auto;&nbsp;text-align:&nbsp;center;&nbsp;line-height:&nbsp;50px;}\r\n.mainmove{position:&nbsp;absolute;&nbsp;opacity:&nbsp;0.7}\r\n.maind{background:&nbsp;#fff;&nbsp;border:1px&nbsp;dashed&nbsp;#efefef;}\r\n.mainend{position:&nbsp;static;&nbsp;opacity:&nbsp;1;}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u672c\u6587\u7684\u5168\u90e8\u5185\u5bb9\uff0c\u5e0c\u671b\u672c\u6587\u7684\u5185\u5bb9\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6216\u8005\u5de5\u4f5c\u80fd\u5e26\u6765\u4e00\u5b9a\u7684\u5e2e\u52a9\uff0c\u540c\u65f6\u4e5f\u5e0c\u671b\u591a\u591a\u652f\u6301PHP\u4e2d\u6587\u7f51\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u4e4b\u62d6\u62fd\u6392\u5e8f\u7684\u793a\u4f8b\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\u4e3b\u8981\u5206\u4eab\u4e86\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u62d6\u62fd\u6392\u5e8f\u7684\u793a\u4f8b\u4ee3\u7801\u3002\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u4ef7\u503c\uff0c\u4e0b\u9762\u8ddf\u7740\u5c0f\u7f16\u4e00\u8d77\u6765\u770b\u4e0b\u5427 index.wxml &lt;!&#8211;index.wxml&#8211;&gt; &lt;view&gt; &nbsp;&lt;view&gt; &nbsp;&lt;view&gt;{{item.content}}&lt;\/view&gt; &nbsp;&lt;\/view&gt;&lt;\/view&gt; \u767b\u5f55\u540e\u590d\u5236 index. \/\/index.js \/\/\u83b7\u53d6\u5e94\u7528\u5b9e\u4f8b var&nbsp;app&nbsp;=&nbsp;getApp(); var&nbsp;x,y,x1,y1,x2,y2,index,currindex,n,yy; var&nbsp;arr1&nbsp;=&nbsp;[{content:11,id:1},{content:22,id:2},{content:33,id:3},{content:44,id:4},{content:55,id:5}]; Page({ &nbsp;data:&nbsp;{ &nbsp;mainx:0, &nbsp;content:[{content:11,id:1},{content:22,id:2},{content:33,id:3},{content:44,id:4},{content:55,id:5}], &nbsp;start:{x:0,y:0} &nbsp;}, &nbsp;movestart:function(e){ &nbsp;currindex&nbsp;=&nbsp;e.target.dataset.index; &nbsp;&nbsp;x&nbsp;=&nbsp;e.touches[0].clientX; &nbsp;&nbsp;y&nbsp;=&nbsp;e.touches[0].clientY; &nbsp;&nbsp;x1&nbsp;=&nbsp;e.currentTarget.offsetLeft; &nbsp;&nbsp;y1&nbsp;=&nbsp;e.currentTarget.offsetTop; &nbsp;}, &nbsp;move:function(e){ &nbsp;yy&nbsp;=&nbsp;e.currentTarget.offsetTop; &nbsp;x2&nbsp;=&nbsp;e.touches[0].clientX-x+x1; &nbsp;y2&nbsp;=&nbsp;e.touches[0].clientY-y+y1; &nbsp;this.setData({ &nbsp;&nbsp;mainx:currindex, &nbsp;&nbsp;opacity:0.7, &nbsp;&nbsp;start:{x:x2,y:y2} &nbsp;}) &nbsp;}, &nbsp;moveend:function(){ &nbsp;if(y2&nbsp;!=&nbsp;0){ &nbsp;&nbsp;var&nbsp;arr&nbsp;=&nbsp;[]; &nbsp;&nbsp;for(var&nbsp;i=0;&nbsp;i&lt;this.data.content.length&gt;(52*(k-1)+k*2-26)){ &nbsp;&nbsp;&nbsp;n=k; &nbsp;&nbsp;} &nbsp;&nbsp;} &nbsp;&nbsp;if(y2&amp;gt;(52*(nx-1)+nx*2-26)){ &nbsp;&nbsp;n&nbsp;=&nbsp;nx; &nbsp;&nbsp;} &nbsp;&nbsp;console.log(arr); &nbsp;&nbsp;console.log(arr1) &nbsp;&nbsp;arr.splice((currindex-1),1); &nbsp;&nbsp;arr.splice((n-1),0,arr1[currindex-1]); &nbsp;&nbsp;arr1&nbsp;=&nbsp;[]; &nbsp;&nbsp;for(var&nbsp;m=0;&nbsp;m&lt;this.data.content.length&gt;&lt;p&gt;index.&lt;a href=&#8221;http:\/\/www.php.cn\/code\/7880.html&#8221; target=&#8221;_blank&#8221;&gt;wxss&lt;\/a&gt;&lt;\/p&gt; [&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-28907","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28907","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=28907"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/28907\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=28907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=28907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=28907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}