首页 > 其他分享 >解决vue移动端 ios页面切换出现闪屏现象(可直接复制张贴)

解决vue移动端 ios页面切换出现闪屏现象(可直接复制张贴)

时间:2023-04-24 14:15:05浏览次数:38  
标签:transitionLeft transitionRight vue 100% ios transform 闪屏 active translate

在App.vue文件中 监听路由

//控制左右滑动   watch: {     $route(to, from) {       const arr = [         '/warningCenter/warningCenterHome',         '/equInspection/equInspectionHome',         '/ourOrder/ourOrderHome',         '/orderCenter/orderCenterHome'       ]       this.transitionName =         arr.indexOf(to.path) > arr.indexOf(from.path)           ? 'transitionLeft'           : 'transitionRight'     }   },

 在create中给transitionName赋值

this.$navigation.on('forward', () => {       this.transitionName = 'transitionRight'     })     this.$navigation.on('back', () => {       this.transitionName = 'transitionLeft'     })

css样式

 

/** 解决路由切换ios左右闪动问题 */ .transitionBody {   transition: all 0.377s ease-out; //设置动画 } .transitionLeft-enter, .transitionRight-leave-active {   -webkit-transform: translate(100%, 0);   transform: translate(100%, 0); } .transitionLeft-leave-active, .transitionRight-enter {   -webkit-transform: translate(-100%, 0);   transform: translate(-100%, 0); } .transitionLeft-enter-active, .transitionRight-enter-active {   //防止过渡时元素抖动   position: absolute;   top: 0;   right: 0;   left: 0;   bottom: 0; }

 

标签:transitionLeft,transitionRight,vue,100%,ios,transform,闪屏,active,translate
From: https://www.cnblogs.com/goging/p/17349303.html

相关文章

  • Vue2入门之超详细教程七-事件处理
    1、简介事件的基本使用:(1)使用v-on:xxx或者@xxx绑定事件,其中xxx是事件名(2)事件的回调需要配置在methods对象中,最终会在vm上(3)methods中配置的函数,不要用箭头函数!否则this就不是vm了(4)methods中配置的函数,都是被Vue所管理的函数,this指向是Vm或......
  • vue3 自定义组件双向绑定(modelValue)
    参考链接:https://huaweicloud.csdn.net/638edf68dacf622b8df8d152.html父组件:<Customabcref="editor"v-model="data.introduction":min-height="400"name="职能"placeholder="请编辑"/>子组件<divclass="tinymc......
  • Vue——eventsMixin【十六】
    前言按着流程接下来就到了eventsMixin,这里面其实主要是$on,$once,$off,$emit的方法定义。内容eventsMixin位于src/core/instance/events.ts下exportfunctioneventsMixin(Vue:typeofComponent){consthookRE=/^hook:///https://v2.cn.vuejs.org/v2/api/#vm-on......
  • axios
    引入axiosnpminstallaxios或者直接引入js文件<scriptsrc="https://unpkg.com/axios/dist/axios.min.js"></script>使用axios//通过params设置参数:axios.get('/url',{params:{ID:123}}).then(function(response){......
  • vue移动端使用(pdfh5) 组件预览PDF
    1、安装插件npmipdfh52、在页面内引入组件importPdfh5from"pdfh5";import"pdfh5/css/pdfh5.css";3、写一个展示pdf文件的容器  <divid="pdfType"></div>4、封装在事件中 initPdf(){      this.pdfh5=''      this.pdfh......
  • 在vue标签代码块中定义变量
     方式一:<template><h1>test</h1><template:set="first=list[0]">//定义变量<div>{{first.name}}</div>//使用变量</template>...</template><script>exportdefault{......
  • 3.Vue脚手架
    3.脚手架3.1.初识3.1.1.简介Vue脚手架/Cli(CommandLineInterface)是Vue官方提供的标准化开发工具(开发平台)。官网:https://cli.vuejs.org/zh/3.1.2.安装全局安装@vue/cli(第一次使用时配置即可)npminstall-g@vue/cli#在使用这串命令之前需要下载好nodejs并且......
  • 【vue】error in ./src/components/NumberInfo/NumberInfo.vue
    出现背景:ant designvuepro执行yarnrunserve解决办法:修改src/components/NumberInfo.vue文件中style部分原来的:<stylelang="less"scoped>@import"index";</style>注释掉 @import"index"<stylelang="less"scoped&g......
  • Vue学习笔记之Node Sass version 8.0.0 is incompatible with 4.0.0错误
    输入以下两个命令:npmuninstallnode-sassnpmi-Dsass注:Mac环境如果进行了系统升级,需要重新安装Xcode,执行命令xcode-selectinstall不然会出现如下的错误Mac解决gyp:NoXcodeorCLTversiondetected!报错 如果出现python2的错误gypverb`which`failedE......
  • 记录在vue3项目中使用wangeditor富文本编译器以及微信小程序中的渲染
    首先,管理后台中的使用npminstallwangeditor//f封装成了组件,以下是组件中的内容<template>  <divstyle="border:1pxsolid#ccc;maxwidth:600px">   <!--工具栏-->   <Toolbar    style="border-bottom:1pxsolid#ccc"    :......