【bug】vuxUI组件popup弹出框在IOS中遮罩层会遮住页面

2024-04-23 17:04

本文主要是介绍【bug】vuxUI组件popup弹出框在IOS中遮罩层会遮住页面,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

可以增加自定义方法v-transfer-dom

   <div v-transfer-dom="true"><Popup v-model="showPopup"><PopupHeader :title="policyloan.docJson.title" /><div class="noticeText"><p v-for="(item, index) in policyloan.docJson.contents" :key="index" :class="item.class">{{ item.content }}</p></div><PopupFooter:class="policyloan.countdown ? 'popupFooterDisabled' : ''"@onConfirm="onConfirm()">{{ policyloan.countdown ? `已阅读(${policyloan.countdown})` : '已阅读' }}</PopupFooter></Popup></div>import TransferDom from '@/transfer-dom'

transfer-dom’.js

const objectAssign = require('object-assign')
/*** Get target DOM Node* @param {(Node|string|Boolean)} [node=document.body] DOM Node, CSS selector, or Boolean* @return {Node} The target that the el will be appended to*/
function getTarget (node) {if (node === void 0) {return document.body}if (typeof node === 'string' && node.indexOf('?') === 0) {return document.body} else if (typeof node === 'string' && node.indexOf('?') > 0) {node = node.split('?')[0]}if (node === 'body' || node === true) {return document.body}return node instanceof window.Node ? node : document.querySelector(node)
}function getShouldUpdate (node) {// do not updated by defaultif (!node) {return false}if (typeof node === 'string' && node.indexOf('?') > 0) {try {const config = JSON.parse(node.split('?')[1])return config.autoUpdate || false} catch (e) {return false}}return false
}const directive = {inserted (el, { value }, vnode) {el.className = el.className ? el.className + ' v-transfer-dom' : 'v-transfer-dom'const parentNode = el.parentNodevar home = document.createComment('')var hasMovedOut = falseif (value !== false) {parentNode.replaceChild(home, el) // moving out, el is no longer in the documentgetTarget(value).appendChild(el) // moving into new placehasMovedOut = true}if (!el.__transferDomData) {el.__transferDomData = {parentNode: parentNode,home: home,target: getTarget(value),hasMovedOut: hasMovedOut}}},componentUpdated (el, { value }) {const shouldUpdate = getShouldUpdate(value)if (!shouldUpdate) {return}// need to make sure children are done updating (vs. `update`)var ref$1 = el.__transferDomData// homes.get(el)var parentNode = ref$1.parentNodevar home = ref$1.homevar hasMovedOut = ref$1.hasMovedOut // recall where home isif (!hasMovedOut && value) {// remove from document and leave placeholderparentNode.replaceChild(home, el)// append to targetgetTarget(value).appendChild(el)el.__transferDomData = objectAssign({}, el.__transferDomData, { hasMovedOut: true, target: getTarget(value) })} else if (hasMovedOut && value === false) {// previously moved, coming back homeparentNode.replaceChild(el, home)el.__transferDomData = objectAssign({}, el.__transferDomData, { hasMovedOut: false, target: getTarget(value) })} else if (value) {// already moved, going somewhere elsegetTarget(value).appendChild(el)}},unbind: function unbind (el, binding) {el.className = el.className.replace('v-transfer-dom', '')if (el.__transferDomData && el.__transferDomData.hasMovedOut === true) {el.__transferDomData.parentNode && el.__transferDomData.parentNode.appendChild(el)}el.__transferDomData = null}
}export default directive

// Thanks to: https://github.com/calebroseland/vue-dom-portal

这篇关于【bug】vuxUI组件popup弹出框在IOS中遮罩层会遮住页面的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/929381

相关文章

Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析

《Spring组件实例化扩展点之InstantiationAwareBeanPostProcessor使用场景解析》InstantiationAwareBeanPostProcessor是Spring... 目录一、什么是InstantiationAwareBeanPostProcessor?二、核心方法解

C++ RabbitMq消息队列组件详解

《C++RabbitMq消息队列组件详解》:本文主要介绍C++RabbitMq消息队列组件的相关知识,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1. RabbitMq介绍2. 安装RabbitMQ3. 安装 RabbitMQ 的 C++客户端库4. A

PyQt6中QMainWindow组件的使用详解

《PyQt6中QMainWindow组件的使用详解》QMainWindow是PyQt6中用于构建桌面应用程序的基础组件,本文主要介绍了PyQt6中QMainWindow组件的使用,具有一定的参考价值,... 目录1. QMainWindow 组php件概述2. 使用 QMainWindow3. QMainW

Python Selenium动态渲染页面和抓取的使用指南

《PythonSelenium动态渲染页面和抓取的使用指南》在Web数据采集领域,动态渲染页面已成为现代网站的主流形式,本文将从技术原理,环境配置,核心功能系统讲解Selenium在Python动态... 目录一、Selenium技术架构解析二、环境搭建与基础配置1. 组件安装2. 驱动配置3. 基础操作模

C#实现查找并删除PDF中的空白页面

《C#实现查找并删除PDF中的空白页面》PDF文件中的空白页并不少见,因为它们有可能是作者有意留下的,也有可能是在处理文档时不小心添加的,下面我们来看看如何使用Spire.PDFfor.NET通过C#... 目录安装 Spire.PDF for .NETC# 查找并删除 PDF 文档中的空白页C# 添加与删

Android与iOS设备MAC地址生成原理及Java实现详解

《Android与iOS设备MAC地址生成原理及Java实现详解》在无线网络通信中,MAC(MediaAccessControl)地址是设备的唯一网络标识符,本文主要介绍了Android与iOS设备M... 目录引言1. MAC地址基础1.1 MAC地址的组成1.2 MAC地址的分类2. android与I

Vue3组件中getCurrentInstance()获取App实例,但是返回null的解决方案

《Vue3组件中getCurrentInstance()获取App实例,但是返回null的解决方案》:本文主要介绍Vue3组件中getCurrentInstance()获取App实例,但是返回nu... 目录vue3组件中getCurrentInstajavascriptnce()获取App实例,但是返回n

SpringQuartz定时任务核心组件JobDetail与Trigger配置

《SpringQuartz定时任务核心组件JobDetail与Trigger配置》Spring框架与Quartz调度器的集成提供了强大而灵活的定时任务解决方案,本文主要介绍了SpringQuartz定... 目录引言一、Spring Quartz基础架构1.1 核心组件概述1.2 Spring集成优势二、J

Vue中组件之间传值的六种方式(完整版)

《Vue中组件之间传值的六种方式(完整版)》组件是vue.js最强大的功能之一,而组件实例的作用域是相互独立的,这就意味着不同组件之间的数据无法相互引用,针对不同的使用场景,如何选择行之有效的通信方式... 目录前言方法一、props/$emit1.父组件向子组件传值2.子组件向父组件传值(通过事件形式)方

Spring组件初始化扩展点BeanPostProcessor的作用详解

《Spring组件初始化扩展点BeanPostProcessor的作用详解》本文通过实战案例和常见应用场景详细介绍了BeanPostProcessor的使用,并强调了其在Spring扩展中的重要性,感... 目录一、概述二、BeanPostProcessor的作用三、核心方法解析1、postProcessB