You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< script setup >
/**
* name:
* user: sa0ChunLuyu
* date: 2023年6月6日 11:01:06
*/
import {
ref
} from 'vue'
import {
$response ,
PostInfoAction ,
} from '@/api'
import {
onShow
} from '@dcloudio/uni-app'
const $props = defineProps ( {
id : {
type : String ,
default : '0'
}
} ) ;
const post _info = ref ( false )
const PostInfo = async ( ) => {
const response = await PostInfoAction ( {
... $props
} )
$response ( response , ( ) => {
post _info . value = response . data . info
post _info . value . content = post _info . value . content . replace ( /<img/gi ,
'<img style="max-width:80%;height:auto;display: block;margin: 0 auto;" ' )
document . title = post _info . value . title
uni . setNavigationBarTitle ( {
title : post _info . value . title
} )
} )
}
onShow ( ( ) => {
PostInfo ( )
} )
< / script >
< template >
< view >
< view class = "top_line_wrapper" > < / view >
< view v-if ="!!post_info" >
< view class = "post_title_wrapper" >
{ { post _info . title } }
< / view >
< view class = "post_box_wrapper" >
< view class = "post_info_wrapper" >
< view class = "post_author_wrapper" > { { post _info . author } } < / view >
< view class = "post_break_wrapper" > < / view >
< view class = "post_date_wrapper" > { { post _info . date } } < / view >
< / view >
< / view >
< view class = "post_line_wrapper" > < / view >
< view class = "post_content_wrapper" v-html ="post_info.content" > < / view >
< / view >
< view class = "blank_wrapper" > < / view >
< / view >
< / template >
< style >
page {
background : # ffffff ;
}
< / style >
< style scoped >
. post _content _wrapper {
width : 666 rpx ;
font - size : 27 rpx ;
font - weight : 400 ;
color : # 525252 ;
line - height : 46 rpx ;
margin : 30 rpx auto 0 ;
}
. post _line _wrapper {
width : 750 rpx ;
height : 1 rpx ;
background : # D1D1D1 ;
margin - top : 30 rpx ;
}
. post _date _wrapper {
margin - left : 18 rpx ;
font - size : 21 rpx ;
font - weight : 400 ;
color : # AFAFAF ;
line - height : 1 ;
}
. post _break _wrapper {
width : 2 rpx ;
height : 22 rpx ;
background : # DBDBDB ;
margin - left : 24 rpx ;
}
. post _box _wrapper {
display : inline - block ;
margin - left : 35 rpx ;
}
. post _info _wrapper {
display : flex ;
align - items : center ;
background : # E6F8FA ;
border - radius : 5 rpx ;
padding : 5 rpx 10 rpx ;
font - size : 23 rpx ;
font - weight : 500 ;
color : # 6 C6C6C ;
line - height : 1 ;
}
. post _title _wrapper {
width : 655 rpx ;
font - size : 34 rpx ;
font - weight : 400 ;
color : # 000000 ;
line - height : 48 rpx ;
margin : 10 rpx auto 0 ;
overflow - wrap : break - word ;
word - wrap : break - word ;
}
< / style >