|
@@ -1,61 +1,76 @@
|
|
<template>
|
|
<template>
|
|
<div>
|
|
<div>
|
|
- <p class="pc-enter" v-if="!isMobile&&!isScaleShow">请在手机端访问</p>
|
|
|
|
|
|
+ <p class="pc-enter" v-if="!isMobile && !isScaleShow">请在手机端访问</p>
|
|
<div v-else id="app">
|
|
<div v-else id="app">
|
|
- <router-view/>
|
|
|
|
- <portal-target name="notification-outlet"></portal-target>
|
|
|
|
- <portal-target name="notification-detail"></portal-target>
|
|
|
|
- <portal-target name="notification-search"></portal-target>
|
|
|
|
- <portal-target name="notification-usual"></portal-target>
|
|
|
|
- <portal-target name="notification-head"></portal-target>
|
|
|
|
|
|
+ <keep-alive>
|
|
|
|
+ <router-view v-if="$route.meta.keepAlive"></router-view>
|
|
|
|
+ </keep-alive>
|
|
|
|
+ <router-view v-if="!$route.meta.keepAlive">
|
|
|
|
+ </router-view>
|
|
|
|
+ <!-- <router-view/> -->
|
|
|
|
+ <portal-target name="notification-outlet"></portal-target>
|
|
|
|
+ <portal-target name="notification-detail"></portal-target>
|
|
|
|
+ <portal-target name="notification-search"></portal-target>
|
|
|
|
+ <portal-target name="notification-usual"></portal-target>
|
|
|
|
+ <portal-target name="notification-head"></portal-target>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script>
|
|
<script>
|
|
- export default {
|
|
|
|
- name:'App',
|
|
|
|
- data:()=>{
|
|
|
|
- return{
|
|
|
|
- isMobile:/(iPhone|iPad|iPod|iOS|Android|SymbianOS|Windows Phone)/i.test(navigator.appVersion),
|
|
|
|
- isScaleShow:false,
|
|
|
|
|
|
+export default {
|
|
|
|
+ name: "App",
|
|
|
|
+ data: () => {
|
|
|
|
+ return {
|
|
|
|
+ isMobile: /(iPhone|iPad|iPod|iOS|Android|SymbianOS|Windows Phone)/i.test(
|
|
|
|
+ navigator.appVersion
|
|
|
|
+ ),
|
|
|
|
+ isScaleShow: false,
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ $route(to, from) {
|
|
|
|
+ console.log(to, from);
|
|
|
|
+ if (to.path !== "/ScaleShow") {
|
|
|
|
+ this.isScaleShow = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- watch:{
|
|
|
|
- $route(to,from){
|
|
|
|
- console.log(to,from)
|
|
|
|
- if(to.path!=="/ScaleShow"){
|
|
|
|
- this.isScaleShow = false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted(){
|
|
|
|
- const isShow = this.$route.path==="/ScaleShow";
|
|
|
|
- this.isScaleShow = isShow;
|
|
|
|
- //console.log(isScaleShow,this.$route)
|
|
|
|
- if(!this.isMobile&&!isShow){
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- (/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
|
|
|
|
- // 这里加了个类型判断,因为a等元素也会触发blur事件
|
|
|
|
- if(['input', 'textarea'].includes(e.target.localName)) {
|
|
|
|
- // if(MobileDevice.getModels().join(' or ').indexOf('6') == -1){
|
|
|
|
- // document.activeElement.scrollIntoView({behavior: "smooth",block:'end'})
|
|
|
|
- // }
|
|
|
|
- setTimeout(()=> {
|
|
|
|
- document.scrollingElement.scrollTo(0, document.scrollingElement.scrollTop);
|
|
|
|
- }, 100);
|
|
|
|
- }
|
|
|
|
- }, true)
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ const isShow = this.$route.path === "/ScaleShow";
|
|
|
|
+ this.isScaleShow = isShow;
|
|
|
|
+ //console.log(isScaleShow,this.$route)
|
|
|
|
+ if (!this.isMobile && !isShow) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ /iphone|ipod|ipad/i.test(navigator.appVersion) &&
|
|
|
|
+ document.addEventListener(
|
|
|
|
+ "blur",
|
|
|
|
+ (e) => {
|
|
|
|
+ // 这里加了个类型判断,因为a等元素也会触发blur事件
|
|
|
|
+ if (["input", "textarea"].includes(e.target.localName)) {
|
|
|
|
+ // if(MobileDevice.getModels().join(' or ').indexOf('6') == -1){
|
|
|
|
+ // document.activeElement.scrollIntoView({behavior: "smooth",block:'end'})
|
|
|
|
+ // }
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ document.scrollingElement.scrollTo(
|
|
|
|
+ 0,
|
|
|
|
+ document.scrollingElement.scrollTop
|
|
|
|
+ );
|
|
|
|
+ }, 100);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ true
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+};
|
|
</script>
|
|
</script>
|
|
<style lang="less">
|
|
<style lang="less">
|
|
- @import "./less/index.less";
|
|
|
|
- .pc-enter{
|
|
|
|
- margin: 20px 0 0;
|
|
|
|
- text-align: center;
|
|
|
|
- font-size: 14px;
|
|
|
|
- }
|
|
|
|
|
|
+@import "./less/index.less";
|
|
|
|
+.pc-enter {
|
|
|
|
+ margin: 20px 0 0;
|
|
|
|
+ text-align: center;
|
|
|
|
+ font-size: 14px;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|
|
|
|
|
|
|
|
|