1.0.2 • Published 5 years ago

wxapp-computed v1.0.2

Weekly downloads
5
License
ISC
Repository
github
Last release
5 years ago

wxapp-computed

在小程序中使计算值(computed),易用、轻量、无依赖、无侵入。

Installation

npm install wxapp-computed

Example

import computed from 'wxapp-computed'

Page(
  computed({
    data: {
      name: 'Messi',
      get uppercaseName() {
        return this.name.toUpperCase()
      },
      get reversedName() {
        return this.uppercaseName.split('').reverse().join('')
      }
    },
    onLoad() {
      // this.setData({ name: 'Ronaldo' })
    }
    // ...
  })
)
<view>
  {{name}} / {{uppercaseName}} / {{reversedName}}
</view>

API

computed(page:Object)

传入 page 页面对象.

License

ISC