Sha256: daae5d2583a0af433a353b7d985765fc2ec1e320d711b88a593b4b73060e4746

Contents?: true

Size: 677 Bytes

Versions: 3

Compression:

Stored size: 677 Bytes

Contents

var _ = require('../../util')

module.exports = {

  bind: function () {
    var self = this
    var el = this.el
    var number = this._checkParam('number') != null
    var expression = this._checkParam('exp')

    this.getValue = function () {
      var val = el.value
      if (number) {
        val = _.toNumber(val)
      } else if (expression !== null) {
        val = self.vm.$eval(expression)
      }
      return val
    }

    this.on('change', function () {
      self.set(self.getValue())
    })

    if (el.checked) {
      this._initValue = this.getValue()
    }
  },

  update: function (value) {
    this.el.checked = _.looseEqual(value, this.getValue())
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
statixite-1.0.2 vendor/assets/bower_components/vue/src/directives/model/radio.js
statixite-1.0.1 vendor/assets/bower_components/vue/src/directives/model/radio.js
statixite-1.0.0 vendor/assets/bower_components/vue/src/directives/model/radio.js