3.1.3 • Published 11 months ago

@cherry-tomato/react v3.1.3

Weekly downloads
17
License
MIT
Repository
github
Last release
11 months ago

@cherry-tomato/react

npm version

介绍

cherry-tomato 配合 react 使用的工具,使页面自动更新的框架

安装

npm install --save @cherry-tomato/react

API 目录

API 介绍

observer 监听组件 Props

绑定方法1: 作为 Component 类的装饰其,会自监听Props中传入的 Model 并响应更新

  import { Model } from '@cherry-tomato/core';
  import { observer } from '@cherry-tomato/react';

  class Item extend Model {
    ...
  }

  @observer()
  class CustomComponent extends React.Component {
    render () {
      const item = this.props.item;
      return (
        <div>{item.title}</div>
      )
    }
  }

  (
    <CustomComponent item={new Item()} />
  )

observe 监听组件属性

绑定方法2: 作为 Component 属性的装饰其,会自监听item并响应更新

  import { Model } from '@cherry-tomato/core';
  import { observer } from '@cherry-tomato/react';

  class Item extend Model {
    ...
  }

  class CustomComponent extends React.Component {
    @observe
    item = new Item();

    render () {
      const item = this.item;
      return (
        <div>{item.title}</div>
      )
    }
  }
3.1.3

11 months ago

3.1.2

12 months ago

3.1.1

12 months ago

3.1.0

1 year ago

3.0.0-beta.1

2 years ago

3.0.0-beta.3

2 years ago

3.0.0-beta.2

2 years ago

3.0.0

2 years ago

3.0.0-beta.0

2 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.7

5 years ago

2.0.5

5 years ago

2.0.6

5 years ago

2.0.3

5 years ago

2.0.4

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0-alpha.9

5 years ago

2.0.0-alpha.8

5 years ago

2.0.0-alpha.7

6 years ago

2.0.0-alpha.6

6 years ago

2.0.0-alpha.5

6 years ago

2.0.0-alpha.4.1

6 years ago

2.0.0-alpha.4

6 years ago

2.0.0-alpha.3

6 years ago

2.0.0-alpha.2

6 years ago