|
@@ -1,5 +1,8 @@
|
|
<template>
|
|
<template>
|
|
- <div class="CollectionsInfo" tabindex="0">
|
|
|
|
|
|
+ <div class="CollectionsInfo" tabindex="0" :style="{
|
|
|
|
+ top: needPaddingTop ? '105px' : '0',
|
|
|
|
+ bottom: needPaddingBottom ? '219px' : '0',
|
|
|
|
+ }">
|
|
<div class="pic">
|
|
<div class="pic">
|
|
<h3 v-html="infoObj.h3" tabindex="0"
|
|
<h3 v-html="infoObj.h3" tabindex="0"
|
|
:aria-description="infoObj.h3.replace(/(<([^>]+)>)/ig, '')"
|
|
:aria-description="infoObj.h3.replace(/(<([^>]+)>)/ig, '')"
|
|
@@ -38,6 +41,10 @@
|
|
<!-- 看大图的遮造盒子 -->
|
|
<!-- 看大图的遮造盒子 -->
|
|
<div ref="cover" class="cover" v-show="bigShow" tabindex="0"
|
|
<div ref="cover" class="cover" v-show="bigShow" tabindex="0"
|
|
@click="bigimgHide" @keydown.enter.passive="bigimgHide"
|
|
@click="bigimgHide" @keydown.enter.passive="bigimgHide"
|
|
|
|
+ :style="{
|
|
|
|
+ top: needPaddingTop ? '105px' : '0',
|
|
|
|
+ bottom: needPaddingBottom ? '219px' : '0',
|
|
|
|
+ }"
|
|
>
|
|
>
|
|
<div
|
|
<div
|
|
class="lookBox"
|
|
class="lookBox"
|
|
@@ -85,6 +92,9 @@ export default {
|
|
bigNumLeft: "0px",
|
|
bigNumLeft: "0px",
|
|
timeId: null,
|
|
timeId: null,
|
|
timeIdBig: null,
|
|
timeIdBig: null,
|
|
|
|
+
|
|
|
|
+ needPaddingTop: false,
|
|
|
|
+ needPaddingBottom: false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
//监听属性 类似于data概念
|
|
//监听属性 类似于data概念
|
|
@@ -125,9 +135,33 @@ export default {
|
|
clearInterval(this.timeIdBig);
|
|
clearInterval(this.timeIdBig);
|
|
this.$el.focus()
|
|
this.$el.focus()
|
|
},
|
|
},
|
|
|
|
+ onAriaShow() {
|
|
|
|
+ this.needPaddingTop = true
|
|
|
|
+ },
|
|
|
|
+ onAriaHide() {
|
|
|
|
+ this.needPaddingTop = false
|
|
|
|
+ },
|
|
|
|
+ onAriaShowMagnifyArea() {
|
|
|
|
+ this.needPaddingBottom = true
|
|
|
|
+ },
|
|
|
|
+ onAriaHideMagnifyArea() {
|
|
|
|
+ this.needPaddingBottom = false
|
|
|
|
+ },
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
- created() {},
|
|
|
|
|
|
+ created() {
|
|
|
|
+ if ([...document.body.classList].includes('aria-active')) {
|
|
|
|
+ this.needPaddingTop = true
|
|
|
|
+ }
|
|
|
|
+ if ([...document.body.classList].includes('aria-magnifying')) {
|
|
|
|
+ this.needPaddingBottom = true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.$eventBus.$on('aria-show', this.onAriaShow)
|
|
|
|
+ this.$eventBus.$on('aria-hide', this.onAriaHide)
|
|
|
|
+ this.$eventBus.$on('aria-show-magnify-area', this.onAriaShowMagnifyArea)
|
|
|
|
+ this.$eventBus.$on('aria-hide-magnify-area', this.onAriaHideMagnifyArea)
|
|
|
|
+ },
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {
|
|
mounted() {
|
|
this.$el.focus()
|
|
this.$el.focus()
|
|
@@ -161,6 +195,10 @@ export default {
|
|
destroyed() {
|
|
destroyed() {
|
|
// 清除定时器
|
|
// 清除定时器
|
|
clearInterval(this.timeId);
|
|
clearInterval(this.timeId);
|
|
|
|
+ this.$eventBus.$off('aria-show', this.onAriaShow)
|
|
|
|
+ this.$eventBus.$off('aria-hide', this.onAriaHide)
|
|
|
|
+ this.$eventBus.$off('aria-show-magnify-area', this.onAriaShowMagnifyArea)
|
|
|
|
+ this.$eventBus.$off('aria-hide-magnify-area', this.onAriaHideMagnifyArea)
|
|
}, //生命周期 - 销毁完成
|
|
}, //生命周期 - 销毁完成
|
|
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
};
|
|
};
|
|
@@ -169,10 +207,8 @@ export default {
|
|
.CollectionsInfo {
|
|
.CollectionsInfo {
|
|
z-index: 991;
|
|
z-index: 991;
|
|
position: fixed;
|
|
position: fixed;
|
|
- top: 0;
|
|
|
|
left: 0;
|
|
left: 0;
|
|
- min-width: 100vw;
|
|
|
|
- min-height: 100vh;
|
|
|
|
|
|
+ right: 0;
|
|
background-color: rgba(17, 16, 16, 0.5);
|
|
background-color: rgba(17, 16, 16, 0.5);
|
|
overflow-y: auto;
|
|
overflow-y: auto;
|
|
.pic {
|
|
.pic {
|
|
@@ -265,11 +301,9 @@ export default {
|
|
// 看大图
|
|
// 看大图
|
|
.cover {
|
|
.cover {
|
|
position: fixed;
|
|
position: fixed;
|
|
- top: 0;
|
|
|
|
left: 0;
|
|
left: 0;
|
|
|
|
+ right: 0;
|
|
z-index: 999;
|
|
z-index: 999;
|
|
- width: 100vw;
|
|
|
|
- height: 100vh;
|
|
|
|
background-color: #000;
|
|
background-color: #000;
|
|
text-align: center;
|
|
text-align: center;
|
|
.lookBox {
|
|
.lookBox {
|