<view class='container'>
  <view class='title'>我的课程</view>
  <block wx:for='{{courses}}' wx:key='id'>
    <view class='course'>{{item.name}}</view>
  </block>
</view>
<style>
  .container {
    padding: 20px;
  }
  .title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
  }
  .course {
    font-size: 18px;
    margin-bottom: 10px;
  }
</style>
<script>
Page({
  data: {
    courses: [
      {
        id: 1,
        name: '语文'
      },
      {
        id: 2,
        name: '数学'
      },
      {
        id: 3,
        name: '英语'
      }
    ]
  }
})
</script>
<p>注:此代码仅供参考,需要在微信开发者工具中创建小程序并导入代码才能正常运行。</p>
微信小程序:学生选课列表页面示例

原文地址: https://www.cveoy.top/t/topic/n0fv 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录