当前位置: 首页 > wzjs >正文

当阳网站建设电话手机微信网站开发

当阳网站建设电话,手机微信网站开发,北京网站制作招聘网,视频教程网uni-app开发的页面跳转全局加载中首先需要下载插件创建加载中页面组件app.vue页面中监听跳转首先需要下载插件 https://ext.dcloud.net.cn/plugin?id20613 创建加载中页面组件 <!-- 全局自定义加载中 --> <template><view v-if"visible" class&qu…

uni-app开发的页面跳转全局加载中

    • 首先需要下载插件
    • 创建加载中页面组件
    • app.vue页面中监听跳转

首先需要下载插件

https://ext.dcloud.net.cn/plugin?id=20613

创建加载中页面组件

<!-- 全局自定义加载中 -->
<template><view v-if="visible" class="global-loading"><!-- 使用CSS实现加载动画,避免性能问题 --><xtf-loader6 style="margin-top: 30rpx;"></xtf-loader6><xtf-loader10 class="item" style="margin-top: 10rpx;"></xtf-loader10><text class="loading-text">{{ text }}</text></view>
</template><script>
export default {data() {return {visible: false,text: '加载中...'}},methods: {show(text) {this.text = text || '加载中...'this.visible = true},hide() {this.visible = false}}
}
</script><style scoped>
.global-loading {position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(255, 255, 255, 1);display: flex;flex-direction: column;justify-content: center;align-items: center;z-index: 9999;
}.loading-spinner {display: flex;margin-bottom: 16px;
}.spinner-dot {width: 12px;height: 12px;margin: 0 6px;background-color: #007aff;border-radius: 100%;animation: spinner-bounce 1.4s infinite ease-in-out both;
}.spinner-dot:nth-child(1) {animation-delay: -0.32s;
}.spinner-dot:nth-child(2) {animation-delay: -0.16s;
}@keyframes spinner-bounce {0%, 80%, 100% { transform: scale(0);opacity: 0.5;} 40% { transform: scale(1);opacity: 1;}
}.loading-text {font-size: 14px;margin-top: 15px;color: #666;
}
</style>


这个就是那个插件里面的小组件,可以用在加载中进行显示,插件下载安装好后,就这样直接使用代码去调用,不用再多做别的配置。

app.vue页面中监听跳转

<template><view><global-loading ref="globalLoading"></global-loading><router-view /></view>
</template>
<script>import GlobalLoading from "@/components/loading/loading.vue"export default {onLaunch: function() {console.log('App Launch')// 初始化路由拦截this.setupRouterInterceptor()},onShow: function() {console.log('App Show')},onHide: function() {console.log('App Hide')},components: { GlobalLoading },methods:{showGlobalLoading(text) {this.$refs.globalLoading.show(text)},hideGlobalLoading() {this.$refs.globalLoading.hide()},setupRouterInterceptor() {const interceptorMethods = ['navigateTo','redirectTo','reLaunch','switchTab']interceptorMethods.forEach(method => {uni.addInterceptor(method, {invoke: (args) => {this.showGlobalLoading('加载中...')return args},success: () => {// 确保页面切换完成后再隐藏setTimeout(() => {this.hideGlobalLoading()}, 1500)},fail: (err) => {this.hideGlobalLoading()console.error('导航失败:', err)},complete: () => {// 兜底确保loading关闭setTimeout(() => {this.hideGlobalLoading()}, 2000)}})})},}}
</script><style>/*每个页面公共css */
</style>

这样就可以实现页面跳转的时候进行加载中显示了!!!

http://www.dtcms.com/wzjs/573658.html

相关文章:

  • 计算机网络技术网站建设方向中企动力邮箱手机版
  • 手机网站设计与规划企业画册封面设计
  • 网站界面友好建设网站的工作职责
  • 百色高端网站建设想再算命网站上登广告怎么做
  • 如何套用网站模板如何做简易的网站
  • 《网页设计与制作》实验报告seo提供服务
  • wordpress回收站+恢复自助商城网站建设
  • 全国的做网站的公司建设 市民中心网站
  • 域名可以同时做邮箱和网站么wordpress首页模板在哪
  • 房山成都网站建设开发出来的电子商务网站域名
  • 电商网站的建设与运营北京线上教学
  • 北京大兴网站建设公司wordpress 数据库表可视化
  • 深圳网站搜索引擎优化没有域名的时候建网站
  • 云南省科技网站做区位图的网站
  • win7 iis7 添加网站电子政务系统网站建设的基本过程
  • 手机网站样式安什么网站建设
  • 商丘销售网站制作设计师网单怎么做
  • 提高网站seo河南省建设科技会网站
  • 时光慢网站建设方案论文武义县建设局网站
  • 郑州 网站开发设计有关的网站
  • 南山商城网站建设哪家服务周到我想在家办个小型加工厂
  • 莱州市网站wordpress 官网主题
  • 大连个人网站建设现在流行什么语言建设网站
  • 河源城乡规划建设局网站精准营销的核心是什么
  • php做电商网站开题报告贺州市八步区乡镇建设局网站
  • 图片外链上传网站设计网站过程
  • 中企动力官网登陆深圳百度推广优化
  • 自己怎样建立个人网站做网站的尺寸
  • 哪个网站上可以做初中数学题女子录视频车流中热舞
  • 软件技术论文题目东莞债优化