【小程序】构建新闻列表Demo

构建新闻列表Demo(上)

目录如下

在这里插入图片描述

初始效果(未加CSS)

在这里插入图片描述

代码如下
  <view>
    <view>
          <image src="/images/avatar/1.png"></image>
          <text>Sep 8 2020</text>
    </view>
    <text>云澈、萧澈</text>
    <image src="/images/post/crab.png"></image>
    <text>怎么回事……难道我还没有死?我明明坠下了绝云崖,怎么可能还活着!而且身上居然没有痛感……连不适感都没有?这是怎么回事?</text>
    <view>
          <image src="../../images/icon/chat.png"></image>
          <text>96</text>
          <image src="../../images/icon/view.png"></image>
          <text>112</text>
    </view>
  </view>

构建新闻列表Demo(下)

当前效果(添加CSS后)

在这里插入图片描述

代码如下
  <view class="post-container">
    <view class="post-author-date">
          <image src="/images/avatar/1.png" class="post-author"></image>
          <text class="post-date">Sep 8 2020</text>
    </view>
    <text class="post-title">云澈、萧澈</text>
    <image src="/images/post/crab.png" class="post-image"></image>
    <text class="post-content">怎么回事……难道我还没有死?我明明坠下了绝云崖,怎么可能还活着!而且身上居然没有痛感……连不适感都没有?这是怎么回事?</text>
    <view class="post-like">
          <image src="../../images/icon/chat.png" class="post-like-image"></image>
          <text class="post-like-font">96</text>
          <image class="post-like-image" src="../../images/icon/view.png"></image>
          <text class="post-like-font">112</text>
    </view>
  </view>
.post-container {
  display: flex;
  flex-direction: column;
  margin-top: 20rpx;
  margin-bottom:  40rpx;
  background-color: #fff;
  border-top: 1px solid #ededed;
  border-bottom: 1px solid #ededed;
  padding-bottom: 10rpx;
}

.post-author-date {
  margin: 10rpx 0 20rpx 10rpx;
  /* 水平垂直居中 */
  display: flex;
  flex-direction: row;
  align-items: center;
}

.post-author {
  height: 60rpx;
  width: 60rpx;
  /* vertical-align: middle; */ /* 垂直居中 */
}

.post-date {
  margin-left: 20rpx;
  /* vertical-align: middle; */ /* 垂直居中 */
}

.post-title {
  font-size: 34rpx;
  font-weight: 600;
  color: #333;
  margin-left: 10px;
  margin-bottom: 10px;
}

.post-image {
  width: 100%;
  height: 340rpx;
  margin-bottom: 15px;
}

.post-content {
  font-size: 28rpx;
  color: #666;
  letter-spacing: 2; /* 增加或减少字符间的空白(字符间距) */
  margin-left: 20rpx;
  margin-bottom: 20rpx;
}

.post-like {
  font-size: 26rpx;
  margin-left: 20rpx;
  display: flex;
  flex-direction: row;
  align-items: center;
}

.post-like-image {
  height: 32rpx;
  width: 32rpx;
  margin-right: 16rpx;
}

.post-like-font {
  margin-right: 40rpx;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
小程序是一种可以在手机上快速开发和部署应用的平台,它可以帮助用户更方便地获取所需的信息和服务。而新闻列表demo小程序中的一个示例项目,它用来展示新闻信息列表,方便用户阅读和浏览。 新闻列表demo通常包含以下几个基本功能和特点: 1. 新闻分类:新闻列表demo会将不同类型的新闻进行分类展示,比如国际、国内、娱乐等。用户可以通过选择不同的分类来筛选他们感兴趣的新闻。 2. 新闻标题和摘要:每条新闻会在列表中显示标题和摘要,用户可以通过浏览标题来判断是否要继续阅读该新闻。摘要可以帮助用户快速了解新闻内容的主要点。 3. 图片展示:部分新闻可能会附带相关的图片,这些图片可以在列表中展示,吸引用户的注意力并提供更直观的信息。 4. 新闻来源和发布时间:每条新闻的来源和发布时间也会在列表中显示,用户可以根据这些信息来判断新闻的可信度和时效性。 5. 新闻详情查看:用户可以通过点击某条新闻,在详情页中查看该新闻的详细内容。详情页还可以提供评论、分享和收藏等功能,增强用户与新闻的互动性。 通过这个新闻列表demo,用户可以快速浏览各类新闻,了解时事动态和各种领域的信息。小程序的轻量化和快速性能可以让用户更方便地获取新闻,节省阅读时间。而开发者也可以根据这个demo做一些扩展和定制化的开发,进一步满足用户的需求和提升用户体验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值