GithubHelp home page GithubHelp logo

afeiship / react-upload-weibo Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 163 KB

Weibo upload pictures for react.

License: MIT License

JavaScript 73.64% Ruby 9.60% SCSS 6.81% EJS 9.95%
react upload weibo

react-upload-weibo's Introduction

react-upload-weibo

Weibo upload pictures for react.

version license size download

installation

npm install -S @jswork/react-upload-weibo

properties

Name Type Required Default Description
className string false - The extended className for component.
onChange func false noop The change handler.
limit number false 10 The max upload limit.
token string false - The weibo oss token.

usage

  1. import css
@import "~@jswork/react-upload-weibo/dist/style.css";

// or use sass
@import "~@jswork/react-upload-weibo/dist/style.scss";

// customize your styles:
$react-upload-weibo-options: ()
  1. import js
import ReactDemokit from '@jswork/react-demokit';
import React from 'react';
import ReactDOM from 'react-dom';
import ReactUploadWeibo from '@jswork/react-upload-weibo';
import './assets/style.scss';

class App extends React.Component {
  state = {
    items: [],
    token:
      'SUB=_2A25NRDndDeRhGeVI7VMZ8yzEyz-IHXVuMCwVrDV_PUNbm9AfLVX9kW9NTBpP0WiKCSBlMw7oSMG7Zy0nrMofP6ea'
  };

  handleChange = (e) => {
    console.log(e.target.value);
    this.setState({ items: e.target.value });
  };

  handleTokenChange = (e) => {
    console.log('token changed.');
  };

  render() {
    const { items } = this.state;

    return (
      <ReactDemokit
        className="p-3 app-container"
        url="https://github.com/afeiship/react-upload-weibo">
        <ReactUploadWeibo
          name="pic1"
          className="input"
          limit={3}
          multiple
          token={this.state.token}
          onChange={this.handleChange}
        />

        <textarea
          className="textarea my-3"
          placeholder="token like this: SUB=_2A25NRDndDeRhGeVI7VMZ8yzEyz-IHXVuMCwVrDV_PUNbm9AfLVX9kW9NTBpP0WiKCSBlMw7oSMG7Zy0nrMofP6ea"
          value={this.state.value}
          onChange={this.handleTokenChange}
        />

        <div className="pic-list">
          {items.map((item) => {
            return <img alt="" key={item.pid} src={item.url} />;
          })}
        </div>
      </ReactDemokit>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('app'));

documentation

license

Code released under the MIT license.

react-upload-weibo's People

Contributors

afeiship avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.