<template> <div class="newsdetailpage"> <div class="main"> <div class="tit">{{ detailData.address }}</div> <div class="time">{{ detailData.trainTime }}</div> <div class="content" v-html="detailData.content"></div> </div> </div> </template> <script setup name="newsdetail"> import { useRoute } from 'vue-router'; import { specialNavDetail } from '@/api/SpongeCulture.js'; const route = useRoute(); const detailData = ref({}); // 获取详情数据 async function getDetail(id) { specialNavDetail(id).then((res) => { if (res && res.code == 200) { detailData.value = res.data; console.log(detailData.value, 'detailData.value'); } }); } onMounted(() => { getDetail(route.query.id); }); </script> <style lang="less"> .newsdetailpage { width: 100%; height: 86%; position: relative; // background: red; background-color: #fff; min-height: 50%; overflow: auto; .main { width: 690px; margin: 0 auto; padding-top: 16px; .tit { font-family: Source Han Sans CN; font-weight: bold; font-size: 36px; color: #121212; line-height: 1.5; padding: 16px auto; text-align: center; } .time { font-family: Source Han Sans CN; font-weight: 400; font-size: 24px; color: #7b7b7e; line-height: 3; } .content { font-family: Source Han Sans CN; font-weight: 400; font-size: 24px; color: #121212; line-height: 1.8; margin: 30px auto; } } } </style>