From ece9b6bba5a44a06041a8ad4d5f5ac1f14560d3e Mon Sep 17 00:00:00 2001 From: 明梦爽 <2972214568@qq.com> Date: 星期二, 09 八月 2022 09:42:12 +0800 Subject: [PATCH] 完善Readme --- src/components/page/zhengce.vue | 116 ++++++++++++++++++++++++++++------------------------------ 1 files changed, 56 insertions(+), 60 deletions(-) diff --git a/src/components/page/zhengce.vue b/src/components/page/zhengce.vue index 8462a8c..9e11455 100644 --- a/src/components/page/zhengce.vue +++ b/src/components/page/zhengce.vue @@ -8,13 +8,13 @@ <el-col :span="4" class="marr10"> <ul> <li v-for="(item, index) in menuList" :key="index" class="liStylenone liPointer marb10" @click="changeMenu(item)"> - <b :class="cont == item.name ? 'ft-blue' : 'ft-black'">{{item.name}}</b> + <b :class="cont == item.name ? 'ft-blue' : 'ft-black'">{{ item.name }}</b> </li> </ul> </el-col> <el-card class="box-card"> - <p class="name">{{this.cont}}</p> - <hr class="namehr"> + <p class="name">{{ this.cont }}</p> + <hr class="namehr" /> <el-col :span="24"> <div> <el-row class="marb10" :key="index" v-for="(item, index) in newsList"> @@ -27,14 +27,7 @@ </div> <!-- 鍒嗛〉 --> <div class="fenye"> - <el-pagination - background - @current-change="handleCurrentChange" - :current-page.sync="currentPage" - :page-size="pageSize" - layout="prev, pager, next,total" - :total="total"> - </el-pagination> + <el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" :page-size="pageSize" layout="prev, pager, next,total" :total="total"> </el-pagination> </div> </el-col> </el-card> @@ -54,69 +47,72 @@ return { cont: '', //灏忔爣棰樺彉鑹� menuList: [], - newsList:[], - pageSize:5, - currentPage:1, - total:0, - item:{}, + newsList: [], + pageSize: 6, + currentPage: 1, + total: 0, + item: {} } }, - created() { - }, + created() {}, mounted() { - this.getTitle(); + this.getTitle() }, watch: { - menuList(n,o){ - this.cont = this.menuList[0].name; - this.item = this.menuList[0]; - this.getnews(this.menuList[0]); + menuList(n, o) { + this.cont = this.menuList[0].name + this.item = this.menuList[0] + this.getnews(this.menuList[0]) } }, methods: { - getTitle(){ - const data = Number(this.$route.query.id); - getMinTitle(data).then(res => { - console.log(res); - if(res.code == 200){ - this.menuList = res.data - } - }).catch(err => { - console.log(err); - }) + getTitle() { + const data = Number(this.$route.query.id) + getMinTitle(data) + .then(res => { + console.log(res) + if (res.code == 200) { + this.menuList = res.data + } + }) + .catch(err => { + console.log(err) + }) }, changeMenu(val) { this.cont = val.name this.item = val this.currentPage = 1 - this.getnews(val); + this.getnews(val) }, - getnews(item){ + getnews(item) { const data = { - current:this.currentPage, - newsCategoryId:item.id, - size:this.pageSize - }; - getNewsList(data).then(res => { - console.log(res); - if(res.code == 200){ - this.newsList = res.data.records - this.total = Number(res.data.total) - } - }).catch(error => { - console.log(error); - }) + current: this.currentPage, + newsCategoryId: item.id, + size: this.pageSize + } + getNewsList(data) + .then(res => { + console.log(res) + if (res.code == 200) { + this.newsList = res.data.records + this.total = Number(res.data.total) + } + }) + .catch(error => { + console.log(error) + }) }, handleCurrentChange(val) { - console.log(`褰撳墠椤�: ${val}`); + console.log(`褰撳墠椤�: ${val}`) // this.currentPage = val - this.getnews(this.item); + this.getnews(this.item) }, // 璺宠浆鍒版柊闂诲睍绀洪〉闈� - show(item){ + show(item) { // console.log(item.id); - this.$router.push({path:'/home/news',query:{id:item.id}}) - }, + this.$router.push({ path: '/home/news', query: { id: item.id } }) + } } } </script> @@ -131,18 +127,18 @@ text-align: center; } } -.ft-blue{ - color:rgb(9, 143, 252); +.ft-blue { + color: rgb(9, 143, 252); } -.ft-black{ +.ft-black { color: #000; } -.box-card{ +.box-card { height: 500px; position: relative; - .fenye{ + .fenye { position: absolute; bottom: 10px; } -} -</style> \ No newline at end of file +} +</style> -- Gitblit v1.8.0