其实不止直播软件搭建,其他软件中也会需要点击按钮弹出提示框的操作,并且在弹出的提示框中还应该能进行选择。显示的直播软件搭建模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。
uni.showModal({
title: '提示',
content: '这是一个模态弹窗',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
test.vue
<template>
<button @click.stop="isLeave()">离厂解绑</button>
</template>
<script>
export default {
data() {
return {};
},
onLoad() {},
methods: {
isLeave(id) {
uni.showModal({
title: '提示',
content: '这是一个模态弹窗',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
},
}
</script>
<style>
</style>
以上就是“完成直播软件搭建中,点击按钮弹出提示框的代码”的全部内容,希望对大家有帮助。其实在直播软件搭建过程中,还会涉及到不同的交互式体验,我们在设计这些功能时,要做到以提升用户的体验为主。