uni-app点击按钮显示 loading 提示框-uni.showLoading(OBJECT)

简介: uni-app点击按钮显示 loading 提示框-uni.showLoading(OBJECT)

uni.showLoading(OBJECT)

显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。

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

一些参数说明:

test.vue例子

<template>
    <button @click.stop="isLeave()">点击按钮</button>
</template>
<script>
    export default {
        data() {
            return {};
        },
        onLoad() {},
        methods: {
            isLeave(id) {
                uni.showLoading({
                    title: '加载中'
                });
            },
        },
    }
</script>
<style>
</style>

这里需要搭配uni.hideLoading()一起使用

设置加载两秒之后,隐藏一下加载框

<template>
    <button @click.stop="isLeave()">点击按钮</button>
</template>
<script>
    export default {
        data() {
            return {};
        },
        onLoad() {},
        methods: {
            isLeave(id) {
                uni.showLoading({
                    title: '加载中'
                });
                setTimeout(function () {
                    uni.hideLoading();
                }, 2000);
            },
        },
    }
</script>
<style>
</style>
目录
打赏
0
0
0
0
11
分享
相关文章
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
551 0
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
852 2
error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
【5月更文挑战第16天】error while loading shared libraries: libxcb-icccm.so.4: cannot open shared object file: No such file or directory 问题如何处理
1459 0
|
11月前
|
深入理解 uni-app 中的加载提示:uni.showLoading
深入理解 uni-app 中的加载提示:uni.showLoading
5526 0
uni-app点击按钮显示消息提示框-uni.showToast(OBJECT)
uni-app点击按钮显示消息提示框-uni.showToast(OBJECT)
260 0
uni-app点击按钮底部弹出提示框-uni.showActionSheet(OBJECT)
uni-app点击按钮底部弹出提示框-uni.showActionSheet(OBJECT)
326 0
|
14天前
|
重学Java基础篇—Java Object类常用方法深度解析
Java中,Object类作为所有类的超类,提供了多个核心方法以支持对象的基本行为。其中,`toString()`用于对象的字符串表示,重写时应包含关键信息;`equals()`与`hashCode()`需成对重写,确保对象等价判断的一致性;`getClass()`用于运行时类型识别;`clone()`实现对象复制,需区分浅拷贝与深拷贝;`wait()/notify()`支持线程协作。此外,`finalize()`已过时,建议使用更安全的资源管理方式。合理运用这些方法,并遵循最佳实践,可提升代码质量与健壮性。
23 1
|
25天前
|
课时78:Object类的基本概念
Object类的主要特点是可以解决参数的统一问题,使用object类可以接受所有的数据类型。 1. Object类简介 2. 观察Object类接收所有子类对象 3. 使用Object类接收数组
Java基础-常用API-Object类
继承是面向对象编程的重要特性,允许从已有类派生新类。Java采用单继承机制,默认所有类继承自Object类。Object类提供了多个常用方法,如`clone()`用于复制对象,`equals()`判断对象是否相等,`hashCode()`计算哈希码,`toString()`返回对象的字符串表示,`wait()`、`notify()`和`notifyAll()`用于线程同步,`finalize()`在对象被垃圾回收时调用。掌握这些方法有助于更好地理解和使用Java中的对象行为。
Java基础的灵魂——Object类方法详解(社招面试不踩坑)
本文介绍了Java中`Object`类的几个重要方法,包括`toString`、`equals`、`hashCode`、`finalize`、`clone`、`getClass`、`notify`和`wait`。这些方法是面试中的常考点,掌握它们有助于理解Java对象的行为和实现多线程编程。作者通过具体示例和应用场景,详细解析了每个方法的作用和重写技巧,帮助读者更好地应对面试和技术开发。
193 4

热门文章

最新文章