前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >uni-app点击按钮底部弹出提示框-uni.showActionSheet(OBJECT)

uni-app点击按钮底部弹出提示框-uni.showActionSheet(OBJECT)

作者头像
王小婷
发布2021-07-01 10:01:41
6.2K0
发布2021-07-01 10:01:41
举报
文章被收录于专栏:编程微刊

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

从底部向上弹出操作菜单

示例

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

test.vue

代码语言:javascript
复制
<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>

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档