uni-app 进入页面显示加载动画
时间: 2023-08-26 12:05:07 浏览: 54
可以在 `onLoad` 钩子函数中使用 `uni.showLoading` 方法显示加载动画,在页面加载完成后使用 `uni.hideLoading` 方法隐藏加载动画。
示例代码:
```vue
<template>
<view class="container">
<text>这是一个页面</text>
</view>
</template>
<script>
export default {
onLoad() {
uni.showLoading({
title: '加载中'
})
},
onReady() {
uni.hideLoading()
}
}
</script>
```
在 `onLoad` 钩子函数中调用 `uni.showLoading` 方法显示加载动画,标题为 `加载中`。在 `onReady` 钩子函数中调用 `uni.hideLoading` 方法隐藏加载动画。