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.
yanzong_qianduan/pages/news/article/detail.vue

82 lines
1.7 KiB

11 months ago
<template>
<view class="article">
11 months ago
<view class="title">{{detail.title}}</view>
<view class="desc">{{detail.create_time}}</view>
11 months ago
<view class="content" v-html="detail.content"></view>
11 months ago
</view>
</template>
<script>
11 months ago
import * as ArticleApi from '@/api/article'
11 months ago
export default {
data() {
11 months ago
return {
// 当前文章ID
articleId: null,
// 当前文章详情
detail: {}
11 months ago
}
11 months ago
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 记录文章ID
this.articleId = options.articleId
// 获取文章详情
this.getArticleDetail()
11 months ago
},
methods: {
11 months ago
// 获取文章详情
async getArticleDetail() {
const {status, message, data} = await ArticleApi.detail(this.articleId);
if(status == 200){
this.detail = data.detail
}
}
},
/**
* 分享当前页面
*/
onShareAppMessage() {
return {
title: this.detail.title,
path: "/pages/news/article/detail?articleId=" + this.articleId
}
},
/**
* 分享到朋友圈
* 本接口为 Beta 版本暂只在 Android 平台支持详见分享到朋友圈 (Beta)
* https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html
*/
onShareTimeline() {
return {
title: this.detail.title,
path: "/pages/news/article/detail?articleId=" + this.articleId
}
11 months ago
}
}
</script>
<style lang="scss" scoped>
.article{
padding: 40rpx 25rpx;
overflow: hidden;
.title{
font-size: 36rpx;
color: #000;
}
.desc{
padding: 30rpx 0;
font-size: 26rpx;
color: #999;
}
.conent{
font-size: 26rpx;
color: #212121;
line-height: 50rpx;
}
}
</style>