You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.7 KiB

8 months ago
<template>
8 months ago
<div class="container">
8 months ago
<el-button style="margin-left: 93%" @click="backHandle" type="success">
返回
</el-button>
<el-divider />
8 months ago
<p class="list-title">{{ data.title }}</p>
8 months ago
<p class="list-summary" v-html="data.content"></p>
8 months ago
<div class="center-image">
8 months ago
<img
class="list-image"
4 months ago
:src="setImageUrl(data.comimg)"
8 months ago
alt="News Image"
8 months ago
/>
8 months ago
</div>
8 months ago
<p class="list-time">{{ data.publishTime }}</p>
8 months ago
</div>
</template>
<script setup lang="ts">
8 months ago
import { ref, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { queryEssayApi } from '@/api/news'
8 months ago
8 months ago
const router = useRouter()
const route = useRoute()
const backHandle = () => {
router.go(-1)
8 months ago
}
8 months ago
const data = ref({})
8 months ago
//通过id获取文章详细信息
8 months ago
queryEssayApi(route.params.id).then((res) => {
8 months ago
data.value = res.result[0]
8 months ago
console.log(`当前id为${route.params.id}新闻详细信息`, data.value)
8 months ago
})
4 months ago
const setImageUrl = (url: string) => {
return import.meta.env.VITE_APP_BASE_API + '/sys/common/static/' + url
}
8 months ago
</script>
<style scoped>
8 months ago
.container {
8 months ago
width: 60%;
margin: auto;
5 months ago
/* height: 98vh; */
/* overflow-y: scroll; */
8 months ago
padding: 0;
display: block;
8 months ago
margin-top: 100px;
8 months ago
}
.container::-webkit-scrollbar {
width: 0;
}
8 months ago
.list-title {
8 months ago
font-size: 25px;
font-weight: 600;
8 months ago
text-align: center;
8 months ago
}
8 months ago
.list-summary {
8 months ago
font-size: 20px;
color: #8c8b8b;
8 months ago
margin-top: 30px;
8 months ago
line-height: 1.9;
8 months ago
}
8 months ago
.center-image {
8 months ago
display: flex;
justify-content: center;
margin-top: 20px;
}
8 months ago
.list-image {
8 months ago
width: 500px;
8 months ago
height: 200px;
8 months ago
margin-top: 20px;
}
8 months ago
.list-time {
8 months ago
font-size: 16px;
color: #999999;
margin-top: 60px;
margin-left: 84%;
8 months ago
}
</style>