代码完形填空学习记录

1.wxml

<swiper circular indicator-dots>#circular使轮播图循环播放 indicator-dots用于显示指示点
</swiper>(最后
 <block wx:for="{{list}}" wx:key="index">#从list中获得轮播项
    <swiper-item>
      <image src="{{item.imgUrl}}" />
    </swiper-item>#在每一个轮播图里从item.imgUrl中获取
  </block>
<view class="button" bind:tap="onClick">
  <image src="{{icon_url}}" />=(一个小图标)
  <view class="text" style="{{style}}">{{content}}</view>#content内容 动态绑定style
</view>#一个里面有字的按钮
 
2.
imageList.where({
db.collection("imageList").where({
这两个语句在有const imageList= db.collection("imageList")后等价
 
onClick() {
  let number = [];
  while (number.length < 4) {
   let randomNum = Math.floor(Math.random() * 10);
   if (!number.includes(randomNum)) {
    number.push(randomNum);}}
作用是生成一个随机数之后取整
如果不在的话就塞进number里面
一共找4个
console.log(number)#打印前面的number
research = db.command#定义一个research
以下是各种生命周期函数:
onLoad(options) {},#监听页面加载
onReady() {},#监听页面初次渲染完成
onShow() {},#监听页面显示
onHide() {},#监听页面隐藏
onUnload() {},监听页面卸载
onPullDownRefresh() {
    this.onClick()#调用onClick
    setTimeout(()=>{wx.stopPullDownRefresh()},2000)#延迟2s执行stopPullDownRefresh函数
 onReachBottom() {},#触底
onShareAppMessage() {}#分享
 
 
 
 
 
 
 
 

 

posted @ 2023-12-11 16:26  Starime  阅读(7)  评论(0)    收藏  举报