1.1.2 • Published 6 years ago

mp-computed v1.1.2

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

像 Vuejs 一样在小程序中使用计算属性

how to use

install mp-computed

npm i mp-computed

use in your page.js

in your page's js file

const { createReactive } = require('mp-computed')

Page({
  onLoad() {
    createReactive.call(this)
  },
  data: {
    name: 'stranger'
  },
  computed: {
    sayHi() {
      return `hello! ${this.data.name}`
    }
  },
  changeName() {
    this.setData({ name: 'nicong622' })
  }
})

in your page's wxml file

<view>{{sayHi}}</view>

<button bindtap="changeName">change name</button>
1.1.2

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago