swiper组件;input按钮使用;wx.storage获取缓存、获取、清除数据等使用方法

130 阅读2分钟

一、小程序swiper

swiper组件的常用属性

indicator-dots     boolean false 是否显示面板指示点

indicator-color    color rgba(0,0,0,.3) 指示点颜色

indicator-active-color   color #O000oo 当前选中的指示点颜色

autoplay     boolean false 是否自动切换

interval      number 5000    自动切换时间间隔

circular     boolean false    是否采用衔接滑动`
复制代码

二、按钮

通过type属性指定按钮颜色类型

<button type="primary">主色调按钮</button>

<button type="warn">警告按钮</button>
复制代码

size="mini" 小尺寸按钮同一行

<button type="primary" size="mini">主色调按钮</button>

<button type="warn" size="mini">警告按钮</button>
复制代码

plain 镂空按钮

<button type="primary" plain>主色调按钮</button>

<button type="warn" plain>警告按钮</button>

wx.setStorageSync(string key, any data)

小程序插件:支持,需要小程序基础库版本不低于 1.9.6

微信 Windows 版:支持

微信 Mac 版:支持

将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。

wx.setStorage(Object object)

Promise 风格 调用:支持

小程序插件:支持,需要小程序基础库版本不低于 1.9.6

微信 Windows 版:支持

微信 Mac 版:支持

将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。

any wx.getStorageSync(string key)

小程序插件:支持,需要小程序基础库版本不低于 1.9.6

微信 Windows 版:支持

微信 Mac 版:支持

从本地缓存中同步获取指定 key 的内容

wx.clearStorageSync()

Promise 风格 调用:支持

小程序插件:不支持

微信 Windows 版:支持

微信 Mac 版:支持

清理本地数据缓存

wx.removeStorage(Object object)

Promise 风格 调用:支持

小程序插件:支持,需要小程序基础库版本不低于 1.9.6

微信 Windows 版:支持

微信 Mac 版:支持

从本地缓存中移除指定 key。