All Projects → zzjian → wx-statuslayout

zzjian / wx-statuslayout

Licence: other
微信小程序页面状态切换组件

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to wx-statuslayout

weapp-OpenRadio
A base music weapp named OpenRadio for wechat. Can use on weapp getting started.
Stars: ✭ 14 (-41.67%)
Mutual labels:  weapp
yudao
遇岛日记/微信小程序/开源代码
Stars: ✭ 16 (-33.33%)
Mutual labels:  weapp
lxUser
Vue2.0 微信公众号 Vux VMUI Vuex
Stars: ✭ 11 (-54.17%)
Mutual labels:  wei-xin
JMGS
基于LBS的微信小程序,服务器端代码在这里server@https://github.com/g1mi/jmgs_server
Stars: ✭ 29 (+20.83%)
Mutual labels:  weapp
zuchemini
微信小程序,租车小程序,租车公司预约小程序
Stars: ✭ 41 (+70.83%)
Mutual labels:  weapp
egg-weapp-sdk
Egg的微信小程序登录会话管理SDK
Stars: ✭ 111 (+362.5%)
Mutual labels:  weapp
weui-scalajs
write WeApp with scalajs
Stars: ✭ 18 (-25%)
Mutual labels:  weapp
Gitter
Gitter for GitHub - 可能是目前颜值最高的GitHub微信小程序客户端
Stars: ✭ 3,555 (+14712.5%)
Mutual labels:  weapp
taro-icons
基于 Taro 的小程序图标库
Stars: ✭ 53 (+120.83%)
Mutual labels:  weapp
mall-app
youlai-mall 微信小程序/H5/Android/iOS 移动应用端,uni-app终极跨平台前端框架。
Stars: ✭ 75 (+212.5%)
Mutual labels:  weapp
vscode-wxml
Wechat wxml support and wxml code snippets for VSCode
Stars: ✭ 19 (-20.83%)
Mutual labels:  weapp
weapp-saucenao
微信小程序: 识图娘
Stars: ✭ 19 (-20.83%)
Mutual labels:  weapp
weapp wechat miniapp sdk
一个封装了微信小程序服务端接口的SDK
Stars: ✭ 102 (+325%)
Mutual labels:  weapp
mpapi
🐤 小程序API兼容插件,一次编写,多端运行。支持:微信小程序、支付宝小程序、百度智能小程序、字节跳动小程序
Stars: ✭ 40 (+66.67%)
Mutual labels:  weapp
we-rich
HTML转微信富文本节点, we just need rich, no text.
Stars: ✭ 36 (+50%)
Mutual labels:  weapp
mini-programm-template
基于原生微信小程序的一般般好用的模板
Stars: ✭ 35 (+45.83%)
Mutual labels:  weapp
vue-authorization-login
vue+express实现微信授权登录demo
Stars: ✭ 21 (-12.5%)
Mutual labels:  wei-xin
mobx-wxapp
在小程序中使用mobx
Stars: ✭ 54 (+125%)
Mutual labels:  weapp
wxml-vscode
👾Vscode plugin -- wechat applets formatting and highlighting components (highly customized)
Stars: ✭ 31 (+29.17%)
Mutual labels:  weapp
BUA-FE
本科毕设,搭建一套小而全面的校园外卖系统。主要使用wei-xin-mini + TypeScript + nest.js + typeORM + rabbitmq技术栈。
Stars: ✭ 20 (-16.67%)
Mutual labels:  wei-xin

wx-statuslayout

微信小程序页面状态切换组件, 如果对您有帮助的话, 就赏个star吧~

效果图

自定义属性

  • rootStyle 根容器样式, 可用来设置组件宽高等
  • status 默认状态
  • emptyImage 无数据时的图片
  • emptyText 无数据时的文案
  • emptyImageWidth 无数据时图片宽度
  • emptyImageHeight 无数据时图片高度
  • errorImage 发生错误时的图片
  • errorText 发生错误时的文案
  • errorImageWidth 错误图片宽
  • errorImageHeight 错误图片高
  • loadingText 加载文案
  • loadingImage 加载图片
  • loadingImageWidth 加载图片宽
  • loadingImageHeight 加载图片高

使用

  1. statusLayout组件拷贝到自己项目中

  2. 修改statuslayout.js 中的属性默认值, 状态图片、文案及图片宽高

  3. 在需要使用的页面json文件中添加引用

    "usingComponents": {
        "statusLayout": "../../components/statusLayout/statusLayout"
    }
  4. 在页面wxss文件中添加statusLayout布局

    <statusLayout id="statusLayout" status='CONTENT' rootStyle="height:{{system.windowHeight-50}}px;">
        //内容
      <block wx:for="{{datas}}" wx:for-index="id" wx:for-item="item">
              <view id="{{id}}">{{item}} </view>
      </block>
    </statusLayout>
  5. 在js文件中使用

    1. 获取statusLayout组件对象 statusLayout = this.selectComponent("#statusLayout")

    2. 切换布局(两种切换布局的方法)

    • 一个方法通过不同参数切换

      statusLayout.setStatus("LOADING")
      
      statusLayout.setStatus("CONTENT")
      
      statusLayout.setStatus("ERROR")
      
      statusLayout.setStatus("EMPTY")
    • 直接调不同的方法切换

      statusLayout.showLoading()
      
      statusLayout.showContent()
          
      statusLayout.showError()
          
      statusLayout.showEmpty()
       
    1. 绑定点击重新加载的回调
      <statusLayout id="statusLayout" errorText="加载失败, 请点击重试" bindOnClickListener='testStatusLayout'>
      
      //testStatusLayout 为页面js文件中加载数据的方法

在不同页面设置不同的状态图片及文案等

<statusLayout id="statusLayout" status='LOADING' errorImage='url' errorText='错误文案' emptyImage='url' emptyText='空文案' rootStyle="height:{{system.windowHeight-50}}px;">
    //内容
</statusLayout>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].