<template>
<button @click="show">显示</button>
<button @click="hide">隐藏</button>
<button @click="deleteMsg">删除</button>
</template>
<script setup>
const show = () => {
uni.showLoading({
mask:false,
title:'加载中',
success: (e) => {
console.log('成功的回调')
},
fail: (e) => {
console.log('失败的回调')
},
complete: (e) => {
console.log('成功或失败都会的回调')
}
})
}
const hide = () => {
uni.hideLoading()
}
const deleteMsg = () => {
uni.showModal({
cancelColor:'#000', // 取消按钮文字颜色
cancelText:'算了吧', // 取消按钮文字
confirmColor:'#e23d30', // 确定按钮文字颜色
confirmText:'搞死它', // 确定按钮文字
content:'这是一段忧郁的文字', // 内容,跟editable同时设置会成为editable的值
editable:true, // 有输入框
placeholderText: '默认文字?', // 输入框的默认文字
showCancel: false, // 隐藏取消按钮
title:'我是标题',
// 回调函数的值是点击的按钮和输入的文本信息
success: (e) => {
console.log('成功的回调',e)
},
fail: (e) => {
console.log('失败的回调',e)
},
complete: (e) => {
console.log('成功或失败都会的回调',e)
}
})
}
</script>