zoukankan      html  css  js  c++  java
  • 小程序随笔

    wx.showToast(OBJECT)

    显示消息提示框

    OBJECT参数说明:

    参数类型必填说明最低版本
    title String 提示的内容  
    icon String 图标,有效值 "success", "loading"  
    image String 自定义图标的本地路径,image 的优先级高于 icon 1.1.0
    duration Number 提示的延迟时间,单位毫秒,默认:1500  
    mask Boolean 是否显示透明蒙层,防止触摸穿透,默认:false  
    success Function 接口调用成功的回调函数  
    fail Function 接口调用失败的回调函数  
    complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

    示例代码:

    wx.showToast({
      title: '成功',
      icon: 'success',
      duration: 2000
    })

    wx.hideLoading()

    基础库 1.1.0 开始支持,低版本需做兼容处理

    隐藏 loading 提示框

    wx.showLoading({
      title: '加载中',
    })
    
    setTimeout(function(){
      wx.hideLoading()
    },2000)



    View~Model动态绑定,联动
    <!-- This is our View -->
    <view> Hello {{name}}! </view>
    <button bindtap="changeName"> Click me! </button>
    
    // This is our App Service.
    // This is our data.
    var helloData = {
      name: 'WeChat'
    }
    
    // Register a Page.
    Page({
      data: helloData,
      changeName: function(e) {
        // sent data change to view
        this.setData({
          name: 'MINA'
        })
      }
    })
     

    缓存读写

    wx.setStorage(OBJECT)   异步方法,可以指定success、fail

    wx.setStorageSync(KEY,DATA)

    wx.getStorage(OBJECT)   异步方法,可以指定success、fail

    wx.getStorageSync(KEY)

     
  • 相关阅读:
    android 面试题
    android 入门-android Studio git 克隆
    android 入门-android自定义控件
    android 入门-控件 测量状态栏高度
    android 入门-android Studio git配置
    WPF 介绍一种在MVVM模式下弹出子窗体的方式
    WPF DataGrid分组和排序
    C# 等待框
    WPF 简洁的主界面
    C# 在WPF中使用Exceptionless异常日志框架
  • 原文地址:https://www.cnblogs.com/nlh774/p/7737832.html
Copyright © 2011-2022 走看看