wxapp-computed

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i wxapp-computed

Weekly Downloads

1

Version

1.0.2

License

ISC

Unpacked Size

3.12 kB

Total Files

3

Last publish

Collaborators

  • b5156