@nosea/mobx

mobx binding for Nosea.

Usage no npm install needed!

<script type="module">
  import noseaMobx from 'https://cdn.skypack.dev/@nosea/mobx';
</script>

README

@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 协议开源。