小程序首页添加左滑删除

This commit is contained in:
范鹏 2024-09-04 14:12:58 +08:00
parent b3c8116007
commit e9b1ea1d7d

View File

@ -17,14 +17,17 @@
<view class="text">填加锁时手机必须在锁旁边</view> <view class="text">填加锁时手机必须在锁旁边</view>
</view> </view>
<view v-else> <view v-else>
<view class="group" v-for="group in lockList" :key="group.groupId"> <view class="group" v-for="(group, grounIndex) in lockList" :key="group.groupId">
<view class="group-name"> <view class="group-name">
<view class="group-name-text">{{group.groupName}}</view> <view class="group-name-text">{{group.groupName}}</view>
<view class="group-name-line"></view> <view class="group-name-line"></view>
</view> </view>
<up-swipe-action class="lock"> <up-swipe-action class="lock">
<up-swipe-action-item class="lock" ref="swipeItem" :options="options" v-for="lock in group.lockList" <up-swipe-action-item class="lock" :ref="'swipeItem' + grounIndex" :options="options" v-for="(lock,
:key="lock.lockId" :threshold="50" @click="deleteLock(lock)"> lockIndex)
in
group.lockList"
:key="lock.lockId" :threshold="50" @click="deleteLock(lock, grounIndex, lockIndex)">
<view class="lock" @click="toLockDeatil(lock)"> <view class="lock" @click="toLockDeatil(lock)">
<view class="lock-top"> <view class="lock-top">
<image class="lock-image-lock" src="/static/images/icon_lock.png"></image> <image class="lock-image-lock" src="/static/images/icon_lock.png"></image>
@ -148,8 +151,10 @@
...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo', ...mapActions(useBluetoothStore, ['getBluetoothStatus', 'initAndListenBluetooth', 'updateCurrentLockInfo',
'checkSetting', 'updateKeyId', 'resetDevice']), 'checkSetting', 'updateKeyId', 'resetDevice']),
...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']), ...mapActions(useBasicStore, ['routeJump', 'getDeviceInfo']),
async deleteLock(lock) { async deleteLock(lock, groupIndex, lockIndex) {
const that = this const that = this
that.$refs['swipeItem' + groupIndex][lockIndex].closeHandler()
if(lock.userType !== 110301 && lock.keyRight === 1) { if(lock.userType !== 110301 && lock.keyRight === 1) {
this.deleteLockInfo = lock this.deleteLockInfo = lock
this.showModal = true this.showModal = true