From ece9b6bba5a44a06041a8ad4d5f5ac1f14560d3e Mon Sep 17 00:00:00 2001 From: 明梦爽 <2972214568@qq.com> Date: 星期二, 09 八月 2022 09:42:12 +0800 Subject: [PATCH] 完善Readme --- src/views/school.vue | 58 +++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/views/school.vue b/src/views/school.vue index 6dfc462..53eadc8 100644 --- a/src/views/school.vue +++ b/src/views/school.vue @@ -4,46 +4,62 @@ <span class="color"><b>瀛﹂櫌鍔ㄦ��</b></span> <span @click="goMore('瀛﹂櫌鍔ㄦ��')" class="liPointer">鏇村<i class="el-icon-d-arrow-right"></i> </span> </el-row> - <div> + <div style="max-height:420px;overflow:hidden;"> <ul> <li :key="index" v-for="(item, index) in schoolList" class="liPointer"> - <!-- <a href="item.path"> {{ item.title }} </a> --> - <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> --> - <div @click="toSchoolMsg(item.title)" class="bgc mart10"> {{ item.title }} </div> + <div @click="toSchoolMsg(item.id)" class="bgc mart10"> + {{ item.title }} + </div> </li> </ul> </div> </div> </template> <script> +import { getNewsList } from '../api/api' export default { name: 'school', data() { return { - schoolList: [ - { id: '1',title: '娌冲崡鐪佺敓鎬佺粡娴庡瀷鏈ㄦ湰妞嶇墿绉嶈川鍒涙柊涓庡埄鐢ㄩ噸鐐瑰疄楠屽寤鸿椤圭洰' }, - { id: '2',title: '骞抽《灞卞闄㈡櫤鎱ф牎鍥蒋浠跺強瀹為獙瀹ょ鐞嗗钩鍙颁簩鏈�' }, - { id: '3',title: '骞抽《灞卞闄㈡柊宸ョ瀹炶妤煎拰浜ф暀铻嶅悎瀹炶妤煎叏杩囩▼璺熻釜瀹¤鏈嶅姟' }, - { id: '4',title: '骞抽《灞卞闄㈡櫤鎱ф牎鍥患鍚堜笟鍔℃湇鍔$郴缁燂紙涓�鏈燂級' }, - { id: '5',title: '骞抽《灞卞闄�2021-2022绗簩瀛︽湡鍖荤敤浣庡�兼槗鑰楀搧閲囪喘椤圭洰鍏憡' }, - { id: '6',title: '骞抽《灞卞闄㈣蒋浠跺疄楠屽纭洏閲囪喘椤圭洰绔炰簤鎬ц皥鍒ゅ叕鍛�' } - ] + schoolList: [] } }, - methods:{ - goMore(val){ + created() { + this.getnews() + }, + methods: { + getnews() { + const data = { + current: 1, + newsCategoryId: 44, + size: 6 + } + getNewsList(data) + .then(res => { + console.log(res) + if (res.code == 200) { + this.schoolList = res.data.records + } + }) + .catch(error => { + console.log(error) + }) + }, + //鍓嶅線鏇村淇℃伅椤甸潰 + goMore(val) { this.$router.push({ - path:'moreMessage', - query:{ - type:val, + path: 'moreMessage', + query: { + type: val } }) }, - toSchoolMsg(t) { + //鍓嶅線淇℃伅灞曠ず椤甸潰 + toSchoolMsg(id) { this.$router.push({ - path: 'schoolMessage', + path: '/home/news', query: { - title:t + id: id } }) } @@ -70,4 +86,4 @@ height: 55px; line-height: 55px; } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0