diff --git a/src/main.js b/src/main.js index f516bcf..a5712c2 100644 --- a/src/main.js +++ b/src/main.js @@ -11,10 +11,6 @@ import 'muse-ui/dist/muse-ui.css'; import './styles/main.styl'; import socket from './socket'; import {queryString} from '@utils/queryString'; -import ios from './utils/ios'; - -// 微信 回弹 bug -ios(); import vuePicturePreview from './components/photo-viewer'; Vue.use(vuePicturePreview); diff --git a/src/utils/ios.js b/src/utils/ios.js index 9de1e74..61a0a92 100644 --- a/src/utils/ios.js +++ b/src/utils/ios.js @@ -2,16 +2,13 @@ export default function () { const u = navigator.userAgent; const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // ios终端 const classList = 'input'; - setTimeout(() => { - [].forEach.call(document.querySelectorAll(classList), function(el) { - el.addEventListener("blur", function(e) { - console.log(1111); - if (isIOS) { - blurAdjust(); - } - }); + [].forEach.call(document.querySelectorAll(classList), function(el) { + el.addEventListener("blur", function(e) { + if (isIOS) { + blurAdjust(); + } }); - }, 1000); + }); // 解决苹果不回弹页面 https://blog.csdn.net/m0_37520980/article/details/86305488 function blurAdjust(e) { diff --git a/src/view/Chat.vue b/src/view/Chat.vue index 1966f76..cc153b4 100644 --- a/src/view/Chat.vue +++ b/src/view/Chat.vue @@ -120,7 +120,8 @@ import Alert from '@components/Alert'; import debounce from 'lodash/debounce'; import url from '@api/server'; -import { setTimeout } from 'timers'; + import { setTimeout } from 'timers'; + import ios from '@utils/ios'; export default{ data() { @@ -157,6 +158,8 @@ import { setTimeout } from 'timers'; this.noticeVersion = res.data.version; }, async mounted() { + // 微信 回弹 bug + ios(); this.container = document.querySelector('.chat-inner'); // socket内部,this指针指向问题 const that = this; diff --git a/src/view/Login.vue b/src/view/Login.vue index d903236..61b7987 100644 --- a/src/view/Login.vue +++ b/src/view/Login.vue @@ -20,6 +20,7 @@ import SvgModal from "@components/svg-modal"; import Alert from "@components/Alert"; import Toast from "@components/Toast"; import socket from "../socket"; +import ios from '@utils/ios'; // import Loading from '../components/loading/loading' export default { @@ -73,6 +74,8 @@ export default { } }, mounted() { + // 微信 回弹 bug + ios(); this.$store.commit("setTab", false); if (!this.getSvgModal) { const svg = SvgModal(); diff --git a/src/view/Register.vue b/src/view/Register.vue index 3e836ee..d13c82c 100644 --- a/src/view/Register.vue +++ b/src/view/Register.vue @@ -23,6 +23,7 @@ import SvgModal from "@components/svg-modal"; import Alert from "@components/Alert"; import Toast from "@components/Toast"; import socket from "../socket"; +import ios from '@utils/ios'; export default { methods: { @@ -73,6 +74,8 @@ export default { } }, mounted() { + // 微信 回弹 bug + ios(); this.$store.commit("setTab", false); if (!this.svgmodal) { const svg = SvgModal();