欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

微信小程序中template模板是什么

這篇文章將為大家詳細講解有關微信小程序中template模板是什么,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

成都創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷、網(wǎng)站重做改版、高青網(wǎng)站定制設計、自適應品牌網(wǎng)站建設、H5高端網(wǎng)站建設商城系統(tǒng)網(wǎng)站開發(fā)、集團公司官網(wǎng)建設、外貿(mào)營銷網(wǎng)站建設、高端網(wǎng)站制作、響應式網(wǎng)頁設計等建站業(yè)務,價格優(yōu)惠性價比高,為高青等各大城市提供網(wǎng)站開發(fā)制作服務。

微信小程序template模板使用

微信小程序中template模板是什么

效果圖

一、模板定義

模板最重要的是模板的名稱,即""

以下是實例模板代碼

<template name="postItem">
 <view class='post-container'>
  <view class='post-author-date'>
   <image class='post-author' src='{{avatar}}'></image>
   <text class='post-date'>{{date}}</text>
  </view>
  <text class='post-title'>{{title}}</text>
  <image class='post-image' src='{{imgSrc}}'></image>
  <text class='post-content'>{{content}}</text>
  <view class='post-like'>
   <image class='post-like-image' src='/images/icon/chat.png'></image>
   <text class='post-link-text'>{{collection}}</text>
   <image class='post-like-image' src='/images/icon/view.png'></image>
   <text class='post-link-text'>{{reading}}</text>
  </view>
 </view>
</template>

wxss文件

 .post-container {
 display: flex;
 flex-direction: column;
 margin-top: 20rpx;
 margin-bottom: 40rpx;
 background-color: white;
 border-bottom: 1px solid #ededed;
 border-top: 1px solid #ededed;
 padding-bottom: 5px;
}
.post-author-date {
 margin: 10rpx 0 20rpx 10rpx;
}
.post-author {
 width: 60rpx;
 height: 60rpx;
 vertical-align: middle;
}
.post-date {
 margin-left: 20rpx;
 vertical-align: middle;
 margin-bottom: 5px;
 font-size: 26rpx;
}
.post-title {
 font-size: 34rpx;
 font-weight: 600;
 color: #333;
 margin-bottom: 10px;
 margin-left: 10px;
 margin-right: 10px;
}
.post-image {
 margin-left: 16px;
 width: 100%;
 height: 340rpx;
 margin: auto 0;
 margin-bottom: 15rpx;
}
.post-content {
 color: #666;
 font-size: 28rpx;
 margin-bottom: 20rpx;
 margin-left: 20rpx;
 margin-right: 20rpx;
 letter-spacing: 2rpx;
 line-height: 40rpx;
}
.post-like {
 font-size: 13px;
 flex-direction: row;
 line-height: 16px;
 margin-left: 16px;
 color: gray;
}
.post-like-image {
 height: 16px;
 width: 16px;
 margin-right: 8px;
 vertical-align: middle;
}
.post-link-text {
 vertical-align: middle;
 margin-right: 20px;
}

二、模板使用

引入模板文件

使用模板文件 用is 使用 模板定義時的名稱 data里面是循環(huán)里面里面的數(shù)據(jù) 用“...”表示的話,就可以把item里面的數(shù)據(jù)全部平鋪出來,這樣在template里面就不用寫“item.xx”了,直接寫item里面的屬性就可以了 要使用template的程序wxml文件

<import src="post-item/post-item-template.wxml" />
<view>
 <block wx:for="{{postList}}" wx:for-item="item">
   <template is="postItem" data="{{...item}}" />
 </block>
</view>

wxss 文件

@import 'post-item/post-item-template.wxss';

關于“微信小程序中template模板是什么”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

本文題目:微信小程序中template模板是什么
URL地址:http://aaarwkj.com/article32/pdhcpc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供關鍵詞優(yōu)化、響應式網(wǎng)站、App設計、網(wǎng)站設計、企業(yè)網(wǎng)站制作、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設公司
最新人妻少妇精品中文字幕视频| 亚洲性感美女男人的天堂| 欧美日韩亚洲国产极品| 欧美成人精品三级在线网站| 天天做日日干夜夜操| 国产毛片久久久久久国产| 亚洲视频精品一区二区三区| 精品福利视频蜜臀91| 久久夜色精品国产高清不卡| 日韩深夜成人在线视频| 蜜臀国产综合久久第一页| 国产超大超粗超爽视频| 亚洲精品麻豆一区二区| 国产日韩欧美一区二区三区四区| 亚洲国产成在人网站天堂| 亚洲国产视频中文字幕| 亚洲国产日韩精品久久| 国产成年人免费小视频| 亚洲和欧洲一码二码区视频| 大片天天看菲色亚洲黄色| 亚洲欧美日韩1区2区| 午夜福利主播一区二区| 亚洲欧美日韩成人在线观看| 亚洲一区二区精品天堂| 老熟妇仑乱换频一区二区| 成人av免费高清在线播放| 天天操天天干蜜桃av| 高清美女视频亚洲免费| 韩日av一区二区三区| 91久久亚洲综合精品成人| 九九国产精品免费视频| 久久国产精品一区免费观看| 三级视频一区二区三区| 中文字幕久久熟女蜜桃| 日韩中文不卡人成在线视频| 成年人免费在线观看毛片| 中文日韩av在线免费播放| 情侣自拍偷拍亚洲天堂区| 久久五月婷婷爱综合亚洲| 亚洲欧美日韩综合精品久久| 香蕉夜夜草草久久亚洲香蕉|