效果
代码
html
<template>
<view>
<button @longpress="handleLongPress">点我出现删除消息</button>
</view>
</template>
<script>
export default {
data() {
return {};
},
methods: {
handleLongPress(e) {
//删除设备
uni.showModal({
title: '提示',
content: '是否删除',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定')
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
}
};
</script>
<style>
.item_all {
margin-bottom: 3%;
}
.position {
padding: 6% 0;
width: 100%;
background-color: #fff;
box-shadow: 4rpx 4rpx 4rpx gainsboro;
}
.vv_1 {
margin: 0 5%;
word-break: break-all;
}
</style>