提交 e3b23a49 编写于 作者: 芊里

小程序标题栏作用域修改

上级 eaf5e117
......@@ -6,25 +6,27 @@
unicloud-db 组件文档:https://uniapp.dcloud.net.cn/uniCloud/unicloud-db-component
DB Schema 规范:https://uniapp.dcloud.net.cn/uniCloud/schema
-->
<view class="article">
<uni-nav-bar :statusBar="true" :border="false"></uni-nav-bar>
<view class="article">
<!-- #ifdef APP-PLUS -->
<uni-nav-bar :statusBar="true" :border="false"></uni-nav-bar>
<!-- #endif -->
<view class="article-title">{{ title }}</view>
<unicloud-db v-slot:default="{data, loading, error, options}" :options="formData" :collection="collection"
:field="field" :getone="true" :where="where" :manual="true" ref="detail"
foreignKey="opendb-news-articles.author" @load="loadData">
<template v-if="!loading && data">
<view class="article-title">{{title}}</view>
<uni-list :border="false">
<uni-list-item thumbSize="lg" :thumb="data.image">
<!-- 通过body插槽定义作者信息内容 -->
<view slot="body" class="header-content">
<view class="uni-title">{{data.author && data.author[0].username}}</view>
<view class="uni-note">更新于
<uni-dateformat :date="data.last_modify_date" format="yyyy-MM-dd"
:threshold="[60000, 2592000000]" />
</view>
</view>
<view slot="footer" class="footer">
<button @click="followClick" class="footer-button">关注</button>
<view slot="footer" class="footer">
<view class="uni-note">更新于
<uni-dateformat :date="data.last_modify_date" format="yyyy-MM-dd hh:mm"
:threshold="[60000, 2592000000]" />
</view>
<!-- <button @click="followClick" class="footer-button">关注</button> -->
</view>
</uni-list-item>
</uni-list>
......@@ -61,7 +63,7 @@
return {
// 当前显示 _id
id: "",
title: '',
title: 'title',
// 数据表名
collection: 'opendb-news-articles,uni-id-users',
// 查询字段,多个字段用 , 分割
......@@ -92,7 +94,7 @@
uni.setNavigationBarTitle({
title: event.title
})
}
}
},
onNavigationBarButtonTap(event) {
if (event.type == 'share') {
......@@ -145,6 +147,7 @@
},
loadData(data) {
console.log(data);
//如果上一页未传递标题过来(如搜索直达详情),则从新闻详情中读取标题
if (this.title == '' && data[0].title) {
this.title = data[0].title
......@@ -153,6 +156,7 @@
});
}
console.log(this.title);
this.setFavorite();
},
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册