3.0.0 • Published 8 months ago

@cherry-tomato/react v3.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
8 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.0.0-beta.1

8 months ago

3.0.0-beta.3

8 months ago

3.0.0-beta.2

8 months ago

3.0.0

8 months ago

3.0.0-beta.0

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.7

3 years ago

2.0.5

3 years ago

2.0.6

3 years ago

2.0.3

3 years ago

2.0.4

3 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0-alpha.9

4 years ago

2.0.0-alpha.8

4 years ago

2.0.0-alpha.7

4 years ago

2.0.0-alpha.6

4 years ago

2.0.0-alpha.5

4 years ago

2.0.0-alpha.4.1

4 years ago

2.0.0-alpha.4

4 years ago

2.0.0-alpha.3

4 years ago

2.0.0-alpha.2

4 years ago