欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序?qū)崿F(xiàn)手指拖動(dòng)選項(xiàng)排序

 更新時(shí)間:2020年04月22日 09:19:02   作者:小程序星座社交  
這篇文章主要介紹了微信小程序?qū)崿F(xiàn)手指拖動(dòng)選項(xiàng)排序,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了微信小程序?qū)崿F(xiàn)手指拖動(dòng)選項(xiàng)排序的具體代碼,供大家參考,具體內(nèi)容如下

效果:

wxml:

<view>
 <view class="dileititle">手指移動(dòng)選項(xiàng)排序</view>
 <view style="width:740rpx;height:80vh;overflow-y:auto;padding:0 90rpx;margin:auto;" id="movebox">
 <block wx:for="{{list}}" wx:key="index">
 <view catchtouchmove="listitemmove" catchtouchend="listitemmove" data-index="{{index}}" class="flex1 dileiitemlist" id="movelist{{index}}" style="left:0;right:0;{{nowmoveindex==index?('position:absolute;top:'+movetop+'px;height:'+itemheight+'px;'):''}}">
 <view class="{{moveoutindex==index?'changemovenow':''}}" style="height:0;transition: height 0.2s;"></view>
 <view class="ranknum">{{index+1}}</view>
 <view class="flex1" style="border-radius:10rpx;width:440rpx;position:relative;color:#fff;">
 <view style="flex:1;text-align: center;margin-right: 20rpx;padding: 20rpx 20rpx;background:#8eb1f7;border-radius:10rpx;">{{item.member.nickname}}</view>
 </view>
 </view>
 </block>
 </view>
</view>
<button class='tijiao' catchtap="lastsubmit">確定</button>

js:

let app = getApp()
app.unitgameinfo = {"members":[{"member":{"nickname":"小程序照片合成","job":"ckext"},},{"member":{"nickname":"高球丸子"},},{"member":{"nickname":"DRobertdsf","job":"黃金"},},{"member":{"nickname":"erer","job":"ckext"},},{"member":{"nickname":"just do it","job":"黃金"},},{"member":{"nickname":"888"},}],};
Page({
 data: {
 },
 onLoad: function (options) {
 var info = app.unitgameinfo,list;
 list = info.members;
 this.setData({options,info,list});
 this.getwxmlcode("#movebox",(resp)=>{
 this.setData({movebox:resp})
 setTimeout(()=>{this.getwxmlcode("#movelist0",(res)=>{
 this.setData({movelist0:res})
 var jiange = res.top-resp.top;
 var yiban = res.bottom - res.top + jiange;
 this.setData({
  itemheight:res.bottom - res.top,
  jiange:yiban, //兩條中間到另一條的距離
  jianqu:resp.top-(res.bottom - res.top)/2, //位置要減去距離
 })
 })},300)
 })
 
 },
 getwxmlcode(str,cal){
 const query1 = wx.createSelectorQuery()
 query1.select(str).boundingClientRect()
 query1.selectViewport().scrollOffset()
 query1.exec((res) => {
 if(cal) cal(res[0])
 })
 },
 listitemmove(e){
 // console.log(e)
 if(e.type=="touchmove"){
 var movetop = e.touches[0].pageY-this.data.itemheight;
 var moveoutindex = parseInt((movetop-this.data.jianqu)/this.data.jiange);
 if(e.currentTarget.dataset.index<=moveoutindex) moveoutindex++;
 this.moveoutindex = moveoutindex;
 this.setData({nowmoveindex:e.currentTarget.dataset.index,movetop,moveoutindex})
 }else{
 let index = e.currentTarget.dataset.index,score = this.data.list;
 let data = {...score[index]};
 score.splice(index,1);
 if(index<=this.moveoutindex-1) this.moveoutindex--;
 score.splice(this.moveoutindex,0,data);
 this.setData({list:score,moveoutindex:-1,nowmoveindex:-1});
 }
 },
 onShow: function(){
 },
 lastsubmit(){
 console.log(this.data.list)
 },
 
})

wxss:

page{background-color: #fff;font-size:30rpx;text-align: center;color: #2952a5;}
.tijiao{
 color: #fff;font-size: 30rpx;line-height: 2.8;
 margin: 20rpx auto 20rpx;width:80vw;position: fixed;bottom: 50rpx;left: 10vw;
 background-color: #2952a5;border-radius:50rpx;
}
.dileiitemlist{justify-content: center;padding-top:30rpx;flex-wrap: wrap;}
.dileititle{font-size: 32rpx;line-height: 100rpx;}
.ranknum{width:60rpx;height: 60rpx;line-height: 60rpx;text-align: center;border-radius:50%;border:1rpx solid #2952a5;margin-right:30rpx;}
.changemovenow{width:100%;height:60px!important;}
.flex1{display:flex;align-items:center;}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 在小程序中使用canvas的方法示例

    在小程序中使用canvas的方法示例

    這篇文章主要介紹了在小程序中使用canvas的方法示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-09-09
  • javascript中的this詳解

    javascript中的this詳解

    avaScript 中的 this 關(guān)鍵字,深入淺出的分析其在不同情況下的含義,形成這種情況的原因以及 Dojo 等 JavaScript 工具中提供的綁定 this 的方法??梢赃@樣說(shuō),正確掌握了 JavaScript 中的 this 關(guān)鍵字,才算邁入了 JavaScript 這門語(yǔ)言的門檻。
    2014-12-12
  • uniapp表單校驗(yàn)超詳細(xì)講解

    uniapp表單校驗(yàn)超詳細(xì)講解

    這篇文章主要給大家介紹了關(guān)于uniapp表單校驗(yàn)的相關(guān)資料,Uni-app內(nèi)置了一些表單驗(yàn)證方法,可以幫助我們對(duì)表單進(jìn)行有效的驗(yàn)證,需要的朋友可以參考下
    2023-10-10
  • 使用JavaScript進(jìn)行進(jìn)制轉(zhuǎn)換將字符串轉(zhuǎn)換為十進(jìn)制

    使用JavaScript進(jìn)行進(jìn)制轉(zhuǎn)換將字符串轉(zhuǎn)換為十進(jìn)制

    JS 是一個(gè)很神奇的語(yǔ)言,可以將任意進(jìn)制字符串轉(zhuǎn)換為十進(jìn)制,如二進(jìn)制,八進(jìn)制,十六進(jìn)制, 第二數(shù)數(shù)不寫即為最常用的轉(zhuǎn)換為整型十進(jìn)制
    2014-09-09
  • sencha ext js 6 快速入門(必看)

    sencha ext js 6 快速入門(必看)

    下面小編就為大家?guī)?lái)一篇sencha ext js 6 快速入門(必看)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-06-06
  • ie中js創(chuàng)建checkbox默認(rèn)選中問(wèn)題探討

    ie中js創(chuàng)建checkbox默認(rèn)選中問(wèn)題探討

    js創(chuàng)建checkbox默認(rèn)選中在某些特殊情況下還是比較實(shí)用的,下面有個(gè)不錯(cuò)的示例,大家可以參考下
    2013-10-10
  • 探討javascript是不是面向?qū)ο蟮恼Z(yǔ)言

    探討javascript是不是面向?qū)ο蟮恼Z(yǔ)言

    這篇文章主要是介紹了javascript是不是面向?qū)ο蟮恼Z(yǔ)言。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2013-11-11
  • javascript+HTML5的canvas實(shí)現(xiàn)七夕情人節(jié)3D玫瑰花效果代碼

    javascript+HTML5的canvas實(shí)現(xiàn)七夕情人節(jié)3D玫瑰花效果代碼

    這篇文章主要介紹了javascript+HTML5的canvas實(shí)現(xiàn)七夕情人節(jié)3D玫瑰花效果代碼,使用了html5的canvas技術(shù),可呈現(xiàn)出帶有3D效果的玫瑰花漸顯效果,非常逼真自然,需要的朋友可以參考下
    2015-08-08
  • ES10 特性的完整指南小結(jié)

    ES10 特性的完整指南小結(jié)

    這篇文章主要介紹了ES10 特性的完整指南小結(jié),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2019-03-03
  • 使用JavaScript實(shí)現(xiàn)Java的List功能(實(shí)例講解)

    使用JavaScript實(shí)現(xiàn)Java的List功能(實(shí)例講解)

    使用JavaScript實(shí)現(xiàn)Java的List功能(實(shí)例講解)。需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
    2013-11-11

最新評(píng)論