<gree-page class="page-list">
<div v-for="(item, index) in timerList" :key="index" class="listItem">
<div class="clickArea" @touchstart="showDeleteButton(index)" @touchend="clearLoop(index)" />
<div class="titleFont">
{{item.title}}
<label class="type">{{item.type}}</label>
</div>
<div class="repeat">{{item.repeat}}</div>
<gree-switch slot="after" v-model="item.enable" @change="select(index)" class="switch"></gree-switch>
</div>
</gree-page>
showDeleteButton(index) {
clearInterval(this.Loop); //再次清空定时器,防止重复注册定时器
this.isDel = false;
this.Loop = setTimeout(() => {
console.log("长按");
this.del(index);
this.isDel = true;
}, 1000);
},
clearLoop(index) {
clearInterval(this.Loop);
if (!this.isDel) {
this.modify(index);
console.log("点击");
}
},
del(index) {
this.$dialog
.confirm({
title: "提示",
message: "是否删除定时?"
})
.then(() => {
// on confirm
})
.catch(() => {
// on cancel
});
},
长按删除弹框确认和点击进入
最新推荐文章于 2023-02-17 23:11:56 发布