美文网首页
uni-app点击按钮底部弹出提示框-uni.showActio

uni-app点击按钮底部弹出提示框-uni.showActio

作者: 祈澈菇凉 | 来源:发表于2021-06-29 17:01 被阅读0次

参考文档:
https://uniapp.dcloud.io/api/ui/prompt?id=showmodal

从底部向上弹出操作菜单

示例

uni.showActionSheet({
    itemList: ['A', 'B', 'C'],
    success: function (res) {
        console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
    },
    fail: function (res) {
        console.log(res.errMsg);
    }
});

test.vue

<template>
    <button @click.stop="isLeave()">离厂解绑</button>
</template>
<script>
    export default {
        data() {
            return {};
        },
        onLoad() {},
        methods: {
            isLeave(id) {
                uni.showActionSheet({
                    itemList: ['A', 'B', 'C'],
                    success: function(res) {
                        console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
                        uni.showToast({
                            title: '点击了第' + res.tapIndex + '个选项',
                            icon: 'none'
                        });
                    },
                    fail: function(res) {
                        console.log(res.errMsg);
                    }
                });
            },
        },
    }
</script>
<style>
</style>

效果:
点击按钮底部弹出提示框
可以选择提示框的相对应的内容

相关文章

网友评论

      本文标题:uni-app点击按钮底部弹出提示框-uni.showActio

      本文链接:https://www.haomeiwen.com/subject/rhihultx.html