新增部分注释优化一些代码

This commit is contained in:
lemon橪
2021-05-24 15:49:22 +08:00
parent dd0c7259e6
commit 3d74e3d907
28 changed files with 209 additions and 752 deletions

View File

@@ -5,7 +5,6 @@
<view class="u-skeleton" v-if="!articleData">
<u-empty text="文章暂无内容" mode="list"></u-empty>
</view>
<!-- <h3>{{routers.title}}</h3> -->
<u-parse v-else :html="articleData"></u-parse>
</view>
</view>
@@ -16,18 +15,20 @@ import { getArticleDetail } from "@/api/article.js";
export default {
data() {
return {
loading: true,
routers: "",
// 用于接收上一级通过路径传输的数据
routers: "",
// 请求文章接口后存储文章信息
articleData: "",
};
},
onLoad(val) {
this.routers = val;
getArticleDetail(val.id).then((res) => {
if (res.data.result) {
// 将请求的文章数据赋值
this.articleData = res.data.result.content;
}
// 修改当前NavigationBar(标题头)为文章头部
uni.setNavigationBarTitle({
title: val.title,
});