一、新建一个模板文件template,里面创建template.wxml和template.wxss文件;
1.template.wxml文件外层要加上template标签,还有加上name名称:
<template name="postItem">
<view class="post-container">
<view class="post-author-date">
<image class="post-author" src="{
{item.avatar}}"></image>
<text class="post-date">{
{item.date}}</text>
</view>
<text class="post-title">{
{item.title}}</text>
<image class="post-image" src="{
{item.imgSrc}}"></image>
<text class="post-content">{
{item.content}}</text>
<view class="post-like">
<image class="post-like-image" src="../../images/icon/chat.png"></image>
<text class="post-like