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.

78 lines
1.7 KiB

9 months ago
<template>
9 months ago
<div class="container">
<el-button style="margin-left: 93%" @click="backHandle" type="success">返回</el-button>
<el-divider/>
9 months ago
<p class="list-title">{{ data.title }}</p>
8 months ago
<p class="list-summary" v-html="data.content"></p>
9 months ago
<div class="center-image">
8 months ago
<img class="list-image" :src="completeImageUrl" alt="News Image" v-default-image>
9 months ago
</div>
8 months ago
<p class="list-time">{{ data.publishTime }}</p>
9 months ago
</div>
</template>
<script setup lang="ts">
8 months ago
import { ref,computed } from 'vue'
9 months ago
import {useRoute, useRouter} from "vue-router";
8 months ago
import {queryEssayApi} from "@/api/news";
9 months ago
const router = useRouter();
const route = useRoute();
const backHandle = ()=>{
router.go(-1);
}
8 months ago
const data = ref({});
//通过id获取文章详细信息
queryEssayApi(route.params.id).then(res=>{
data.value = res.result[0]
console.log(data.value,'data')
})
// 定义一个计算属性来处理图片路径
const completeImageUrl = computed(() => {
if (data.value.comimg) {
return new URL(data.value.comimg, 'https://localhost:18085/jeecg-boot/').href;
}
return '';
});
9 months ago
</script>
<style scoped>
9 months ago
.container{
width: 60%;
margin: auto;
height: 98vh;
overflow-y: scroll;
padding: 0;
display: block;
}
.container::-webkit-scrollbar {
width: 0;
}
9 months ago
.list-title{
font-size: 25px;
font-weight: 600;
9 months ago
text-align: center;
9 months ago
}
.list-summary{
font-size: 20px;
color: #8c8b8b;
8 months ago
margin-top: 30px;
9 months ago
line-height: 1.9;
9 months ago
}
.center-image{
display: flex;
justify-content: center;
margin-top: 20px;
}
.list-image{
width: 500px;
8 months ago
height: 200px;
9 months ago
margin-top: 20px;
}
8 months ago
.list-time{
font-size: 16px;
color: #999999;
margin-top: 60px;
margin-left: 84%;
}
9 months ago
</style>