【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

相关文章

JAVA读取MongoDB中的二进制图片并显示在页面上

1:Jsp页面: <td><img src="${ctx}/mongoImg/show"></td> 2:xml配置: <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001

公共筛选组件(二次封装antd)支持代码提示

如果项目是基于antd组件库为基础搭建,可使用此公共筛选组件 使用到的库 npm i antdnpm i lodash-esnpm i @types/lodash-es -D /components/CommonSearch index.tsx import React from 'react';import { Button, Card, Form } from 'antd'

JavaScript全屏,监听页面是否全屏

在JavaScript中,直接监听浏览器是否进入全屏模式并不直接支持,因为全屏API主要是关于请求和退出全屏模式的,而没有直接的监听器可以告知页面何时进入或退出全屏模式。但是,你可以通过在你的代码中跟踪全屏状态的改变来模拟这个功能。 以下是一个基本的示例,展示了如何使用全屏API来请求全屏模式,并在请求成功或失败时更新一个状态变量: javascriptlet isInFullscreen =

iOS HTTPS证书不受信任解决办法

之前开发App的时候服务端使用的是自签名的证书,导致iOS开发过程中调用HTTPS接口时,证书不被信任 - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAu

React+TS前台项目实战(十七)-- 全局常用组件Dropdown封装

文章目录 前言Dropdown组件1. 功能分析2. 代码+详细注释3. 使用方式4. 效果展示 总结 前言 今天这篇主要讲全局Dropdown组件封装,可根据UI设计师要求自定义修改。 Dropdown组件 1. 功能分析 (1)通过position属性,可以控制下拉选项的位置 (2)通过传入width属性, 可以自定义下拉选项的宽度 (3)通过传入classN

vue同页面多路由懒加载-及可能存在问题的解决方式

先上图,再解释 图一是多路由页面,图二是路由文件。从图一可以看出每个router-view对应的name都不一样。从图二可以看出层路由对应的组件加载方式要跟图一中的name相对应,并且图二的路由层在跟图一对应的页面中要加上components层,多一个s结尾,里面的的方法名就是图一路由的name值,里面还可以照样用懒加载的方式。 页面上其他的路由在路由文件中也跟图二是一样的写法。 附送可能存在

vue+elementui分页输入框回车与页面中@keyup.enter事件冲突解决

解决这个问题的思路只要判断事件源是哪个就好。el分页的回车触发事件是在按下时,抬起并不会再触发。而keyup.enter事件是在抬起时触发。 so,找不到分页的回车事件那就拿keyup.enter事件搞事情。只要判断这个抬起事件的$event中的锚点样式判断不等于分页特有的样式就可以了 @keyup.enter="allKeyup($event)" //页面上的//js中allKeyup(e

vue子路由回退后刷新页面方式

最近碰到一个小问题,页面中含有 <transition name="router-slid" mode="out-in"><router-view></router-view></transition> 作为子页面加载显示的地方。但是一般正常子路由通过 this.$router.go(-1) 返回到上一层原先的页面中。通过路由历史返回方式原本父页面想更新数据在created 跟mounted

vue+elementui--$message提示框被dialog遮罩层挡住问题解决

最近碰到一个先执行this.$message提示内容,然后接着弹出dialog带遮罩层弹框。那么问题来了,message提示框会默认被dialog遮罩层挡住,现在就是要解决这个问题。 由于都是弹框,问题肯定是出在z-index比重问题。由于用$message方式是写在js中而不是写在html中所以不是很好直接去改样式。 不过好在message组件中提供了customClass 属性,我们可以利用

Sapphire开发日志 (十) 关于页面

关于页面 任务介绍 关于页面用户对我组工作量的展示。 实现效果 代码解释 首先封装一个子组件用于展示用户头像和名称。 const UserGrid = ({src,name,size,link,}: {src: any;name: any;size?: any;link?: any;}) => (<Box sx={{ display: "flex", flexDirecti