1.0.13 • Published 6 years ago

xy-loading-react v1.0.13

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

xy-loading-react

英语不好,文档里的英文版是谷歌翻译的,如果不准确请见谅

xy-loading-react是一个为react项目提供多种样式的loading动画和加载占位图的模块

loading动画/加载占位图样式会持续增加,欢迎补充和提需求

English is not good, the English version of the document is Google translation, if not accurate, please forgive me

xy-loading-react is a multi-style loading animation for react projects and a module for loading bitmaps

loading animation / loading bitmap style will continue to increase, are welcome to add and demand

安装 Installation

$ npm i xy-loading-react --save 

使用 Usage

// 引入 Introduced
import XyLoading from 'xy-loading-react';

// 调用 transfer
<XyLoading type="skeleton1" visibility="true"/>

参数 Available Props

prop类型 type默认值 default value说明 description
typestringskeleton1Loaidng动画和加载占位图的类型
visibilitybooltrue该组件是否可见

例子 examples

import React from 'react';
import XyLoading from 'xy-loading-react';

export default class MyComponent extends React.Component{
  
 constructor(props,that) {
     super(props);
     this.state = {
         loadingVisibility:true, 
     };
  }
  
  componentWillMount(){
    
      // 在数据请求完毕后,修改state中XyLoading的可见性
      // After the data request is completed, modify the visibility of XyLoading in state
    
      this.setState({
          loadingVisibility:false, 
      })
      
  }
  
  render(){
    
    // 根据state中的loadingVisibility判断数据是否加载完毕
    // 若加载完则正常显示内容,若未加载完则显示XyLoading
    
    // According to loadingVisibility state to determine whether the data is loaded
    // If loaded finished the normal display, if not loaded then display XyLoading
    
    if(!this.state.loadingVisibility){
        return (
    	  <div>
        	 {this.state.content}
          </div>
        )
    }else{
        return (
    	  <XyLoading type="skeleton1" visibility={this.state.loadingVisibility} />
        )
    }
    
  }
}

type参数效果预览 type parameter effect preview

骨架图类型 Skeleton graph type

skeleton1skeleton2skeleton3skeleton4
skeleton1skeleton2skeleton3skeleton4
1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago