@nosea/mobx

0.1.9 • Public • Published

@nosea/mobx

Mobx@4 binding for @nosea/core.

小程序框架 @nosea/coremobx binding.

使用方法

In app entry:

  import { NoseaApp } from '@nosea/core'
  import NoseaMobxBindPlugin from '@nosea/mobx'

  class MyApp extends NoseaApp {
    static pageData = {}
    static plugins = [
      new NoseaMobxBindPlugin()
    ]

    onLaunch () {
      console.log('app onLaunch')
    }
  }

  export default ThinkieApp

In page entry:

  import { NoseaPage } from '@nosea/core'
  import { observable, computed } from 'mobx'

  class TabPagesView extends NoseaPage {
    static data = {}
    static methods = {}

    @observable foo = {
      bar: 114514
    }
    @computed get bar () {
      return [foo.bar, 1919810]
    }

    onLoad (res) {
      console.log('page onLoad', res, this)
    }

    onShow (res) {
      console.log('page onShow', res, this)
    }
  }

  export default TabPagesView

In page template:

  <view>{{ bar[0] }}</view>
  <view>{{ bar[1] }}</view>

其他

使用 MIT 协议开源。

Readme

Keywords

none

Package Sidebar

Install

npm i @nosea/mobx

Homepage

kt.je/nosea

Weekly Downloads

2

Version

0.1.9

License

MIT

Unpacked Size

4.81 kB

Total Files

5

Last publish

Collaborators

  • nosea