uniapp模态弹窗和菜单选择
<template>
<view>
<view>
<button @tap="test_showModal()">弹出测试</button>
<button @tap="test_showActionSheet()">菜单选择</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
test_showModal(){
uni.showModal({
title: '提示',
content: '这是一个模态弹窗',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
test_showActionSheet(){
uni.showActionSheet({
itemList: ['A', 'B', 'C'],
success: function (res) {
console.log(res);
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function (res) {
console.log(res.errMsg);
}
});
},
}
}
</script>
<style>
</style>
<template>
<view>
<view>
<button @tap="test_showModal()">弹出测试</button>
<button @tap="test_showActionSheet()">菜单选择</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
test_showModal(){
uni.showModal({
title: '提示',
content: '这是一个模态弹窗',
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
test_showActionSheet(){
uni.showActionSheet({
itemList: ['A', 'B', 'C'],
success: function (res) {
console.log(res);
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
},
fail: function (res) {
console.log(res.errMsg);
}
});
},
}
}
</script>
<style>
</style>
更多推荐
所有评论(0)