|
@@ -149,7 +149,7 @@
|
|
|
<div class="xian">
|
|
|
<div
|
|
|
class="xian_son"
|
|
|
- @click="dateInd = item"
|
|
|
+ @click="cutAge(item)"
|
|
|
:class="{ active: item === dateInd }"
|
|
|
v-for="item in dateData"
|
|
|
:key="item"
|
|
@@ -203,15 +203,18 @@ export default {
|
|
|
//监听属性 类似于data概念
|
|
|
computed: {},
|
|
|
//监控data中的数据变化
|
|
|
- watch: {
|
|
|
- dateInd(val) {
|
|
|
- this.imgList = Magazines[val];
|
|
|
+ watch: {},
|
|
|
+ //方法集合
|
|
|
+ methods: {
|
|
|
+ // 切换年份
|
|
|
+ cutAge(age) {
|
|
|
+ this.dateInd = age;
|
|
|
+ this.imgList = Magazines[age];
|
|
|
this.infoInd = 0;
|
|
|
this.info = this.imgList[this.infoInd];
|
|
|
+
|
|
|
+ this.$route.meta.pageAge = age;
|
|
|
},
|
|
|
- },
|
|
|
- //方法集合
|
|
|
- methods: {
|
|
|
toInfo(id) {
|
|
|
this.$router.push({
|
|
|
name: "PublicationsInfo",
|
|
@@ -234,30 +237,32 @@ export default {
|
|
|
}
|
|
|
this.info = this.imgList[this.infoInd];
|
|
|
dom.style.opacity = 1;
|
|
|
+ this.$route.meta.pageSize = this.infoInd;
|
|
|
}, 300);
|
|
|
},
|
|
|
},
|
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
|
created() {
|
|
|
- this.imgList = Magazines[this.dateInd];
|
|
|
- this.info = this.imgList[this.infoInd];
|
|
|
- },
|
|
|
- //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
- mounted() {
|
|
|
- this.$nextTick(() => {
|
|
|
- setTimeout(() => {
|
|
|
- let temp = this.$route.query.m;
|
|
|
- if (temp) {
|
|
|
+ if (this.$route.meta.pageAge) this.dateInd = this.$route.meta.pageAge;
|
|
|
+ if (this.$route.meta.pageSize) {
|
|
|
+ this.infoInd = this.$route.meta.pageSize;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
// 获取滚动的总元素
|
|
|
// 获取元素距离顶部的距离
|
|
|
- let dom = document.querySelector(`#PMbox${temp}`);
|
|
|
+ let dom = document.querySelector(".box3");
|
|
|
// 获取主滚动元素
|
|
|
let domScroll = document.querySelector(".Layout");
|
|
|
- domScroll.scrollTo({ top: dom.offsetTop-140});
|
|
|
- }
|
|
|
- }, 100);
|
|
|
- });
|
|
|
+ domScroll.scrollTo({ top: dom.offsetTop-70 });
|
|
|
+ }, 100);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ this.imgList = Magazines[this.dateInd];
|
|
|
+ this.info = this.imgList[this.infoInd];
|
|
|
},
|
|
|
+ //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
+ mounted() {},
|
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
|
beforeUpdate() {}, //生命周期 - 更新之前
|