menu9.vue 1.35 KB
<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>