Commit 9f9c0fb5 authored by “yiyousong”'s avatar “yiyousong”

perf: 优化首页材料显示

parent 49c42d8e
......@@ -154,9 +154,9 @@ export default {
// [...data.hotDatumList, ...data.datumList],
// "id"
// ).slice(0, 7);
datumList = data.hotDatumList.slice(0, 5);
datumList = data.hotDatumList.slice(0, 7);
} else {
datumList = data.datumList.slice(0, 5);
datumList = data.datumList.slice(0, 7);
}
if (data.hotMatterList) {
// matterList = this.removeDuplication(
......
......@@ -121,10 +121,10 @@
</div>
<!-- 热门表单列表 -->
<div class="ranking-list flex1 flex flexc mt20">
<div v-if="datumList && datumList.length">
<div v-if="CalcDatumList && CalcDatumList.length">
<div
class="ranking-item flex aic"
v-for="(v, i) in datumList"
v-for="(v, i) in CalcDatumList"
:key="v.id"
>
<div class="flex aic jcc item-index">
......@@ -272,7 +272,7 @@
<script>
// import { getHomeInfo } from "@/api";
import MateralsList from "@/components/MateralsList.vue";
import { mapState, mapMutations } from "vuex";
import { mapState, mapMutations, mapGetters } from "vuex";
import { getMaterialsList } from "@/api";
import { deviceSystem } from "@/utils";
import local from "@/utils/local";
......@@ -304,7 +304,8 @@ export default {
waitTime: 2500, // 单行停顿时间(singleHeight,waitTime)
};
},
...mapState(["homeInfo", "datumList", "matterList", "appList", "showApp"]),
...mapGetters(["CalcDatumList"]),
...mapState(["homeInfo", "matterList", "appList", "showApp"]),
},
created() {
// this.getHomeInfo();
......
......@@ -28,6 +28,9 @@ export default new Vuex.Store({
operTime(state) {
return state.operTime;
},
CalcDatumList(state) {
return state.showApp ? state.datumList.slice(0, 5) : state.datumList;
},
},
mutations: {
SET_showApp(state, showApp) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment