menu9.vue
1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<template>
<div>
<el-row :gutter="30">
<el-col :span="12" class="newsimgcover" v-for="n in newsList" v-show="n.picUrl">
<a class="item" :href="n.jumpUrl" target="_blank">
<div class="imgbox" v-if="n.picUrl">
<img :src="fillImgUrl_webSite(n.picUrl)">
</div>
<div class="item-body">
<h3>{{ n.name }}</h3>
</div>
</a>
</el-col>
<el-col :span="24" v-for="n in newsList" v-show="!n.picUrl">
<a :href="n.jumpUrl">
<h3>{{ n.name }}</h3>
</a>
</el-col>
</el-row>
<el-empty v-if="newsList.length == 0" description="暂无数据" />
</div>
</template>
<script setup>
import { ref } from 'vue'
import { getNewsListById } from '@/apiPc/webSite'
import { useRouter } from 'vue-router'
const props = defineProps({
sortId: {
type: String,
required: true
},
code: {
type: String,
required: true
}
})
const router = useRouter()
const newsList = ref([])
const total = ref(0)
const query = ref({
pageSize: 10,
pageNum: 1
})
const getList = () => {
query.value.sortId = props.sortId
query.value.code = props.code
getNewsListById(query.value).then(res => {
newsList.value = res.rows
total.value = res.total
})
}
defineExpose({
getList
})
</script>
<style scoped>
</style>