W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
解釋:圖文詳情頁(yè)模板。你可以加載含有圖片、文本、引用、標(biāo)題等形式的內(nèi)容。同時(shí),圖文詳情頁(yè)模板內(nèi)置了回到頂端按鈕與關(guān)注/取消關(guān)注按鈕,支持點(diǎn)擊作者跳轉(zhuǎn)與圖片查看器。圖文詳情頁(yè)通常用來(lái)展示文章、帖子等內(nèi)容的詳情。
npm i @smt-ui-template/page-content-detail
.
├── project.swan.json
├── app.json
├── app.js
├── pages
└── @smt-ui-template-content-detail // 模板文件
{
"pages": [
...
"pages/@smt-ui-template-content-detail/index/index",
...
]
}
<view class="wrap">
<view s-if="!showPageStatus" class="content-header" ></view>
<scroll-view scroll-y scroll-top="{=scrollTop=}" s-if="!showPageStatus" class="content-container {{isPhoneX ? 'content-container-ipx' : ''}}" bindscroll="onPageScroll" bindtouchmove="scrollPage" bindtouchstart="touchstart">
<view class="content-title">
<text selectable>{{title}}</text>
</view>
<view class="content-desp">
<view class="author-detail" bindtap="tapuser" data-user-id="{{authorId}}">
<image class="author-avator" mode="widthFix" src="{{avator}}"></image>
<view class="author-other">
<view class="author-name">{{author}}</view>
<view class="publish-date">{{date}}</view>
</view>
</view>
<button s-if="showFollowBtn" class="follow-btn" size="mini" type="{{isFollow ? 'default' : 'primary'}}" bindtap="tapfollow" loading="{{btnLoading}}">{{btnLoading ? '' : (isFollow ? '已關(guān)注' : '關(guān)注')}}</button>
</view>
<view class="content-detail">
<view s-for="item in content" class="detail-{{item.type}}">
<quote s-if="item.type == 'quote'" content="{{item.content}}"></quote>
<text selectable s-if="item.type == 'p' || item.type == 'title'">{{item.content}}</text>
<image lazy-load s-if="item.type == 'img'" mode="widthFix" src="{{item.content}}" data-src="{{item.content}}" bindtap="tapimg" bindlongpress="longtapimg"></image>
</view>
</view>
<top class="top-view {{showTopBtn ? 'top-view-show' : 'top-view-hide'}}" bind:top="backToTop"></top>
</scroll-view>
</view>
設(shè)計(jì)指南
為保證信息流分發(fā)時(shí)落地頁(yè)瀏覽體驗(yàn)的一致性,建議正文字號(hào)使用默認(rèn)字號(hào) 57px,如需自定義正文字號(hào),可在正負(fù) 3px 空間內(nèi)浮動(dòng)。
getArticleDetail(articleId, cb) {
let params = {
url: '',
method: 'GET',
data: {
articleId
},
...
swan.navigateTo({
url: `/user-detail/user-detail?userId=${userId}`
});
tapfollow(e) {
...
let params = {
url: '',
method: 'POST',
data: {
authorId: this.data.authorId
},
...
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: