<template>
<view>
<button @click="showModal">显示弹窗</button>
</view>
</template>
<script>
export default {
methods: {
showModal() {
uni.showModal({
title: '提示',
content: '这是一个弹窗',
showCancel: true, // 显示取消按钮
cancelText: '取消',
confirmText: '确定',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
}
};
</script>
10-22
1015