乐编科技--0基础小程序 day05

列表渲染wx:for

JS数组

index————》索引(下标) item————》对应每一项 默认值

  <view wx:for="{{arr}}">
    {{index}}: {{item}}
  </view>

  <view wx:for="{{arr}}" wx:for-index="idx" wx:for-item="itemName">
    {{idx}}: {{itemName}}
  </view>

wx:if 多条件判断

<view wx:if="{{a}}">单个条件</view>
<view wx:if="{{a || b}}">多个或条件</view>
<view wx:if="{{a && b}}">多个且条件</view>

wx:if  wx:elif  wx:else

以下是常见的false
false
undefined
null
0
-0
NaN
" "

JS中的数据类型

Object Array Function string boolean null undefined smybol

微信小程序的事件

事件集合

网页端的事件

授权

授权成功回调

地理位置获取权限

<button open-type="getUserInfo" bindgetuserinfo="getuserinfo">获取用户信息</button>

<button open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">获取手机号</button>

<button bindtap="openSetting">打开设置页</button>

 list: ['scope.userInfo', 'scope.userLocation', 'scope.address', 'scope.invoiceTitle', 'scope.werun', 

'scope.record', 'scope.writePhotosAlbum', 'scope.camera']

  wx.getSetting({
      success: (response) => {
        if (!response.authSetting[str]) {
          wx.authorize({
            scope: str,
            success: () => {
              console.log('授权成功')
            }
          })
        }
      }
    })
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。