PHP Classes

File: public/js/lib/vue/src/directives/public/show.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy  >  Silex MVC Blog  >  public/js/lib/vue/src/directives/public/show.js  >  Download  
File: public/js/lib/vue/src/directives/public/show.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Silex MVC Blog
MVC based blog using on the Silex micro-framework
Author: By
Last change:
Date: 5 years ago
Size: 634 bytes
 

Contents

Class file image Download
import { getAttr, inDoc } from '../../util/index'
import { applyTransition } from '../../transition/index'

export default {

  bind () {
    // check else block
    var next = this.el.nextElementSibling
    if (next && getAttr(next, 'v-else') !== null) {
      this.elseEl = next
    }
  },

  update (value) {
    this.apply(this.el, value)
    if (this.elseEl) {
      this.apply(this.elseEl, !value)
    }
  },

  apply (el, value) {
    if (inDoc(el)) {
      applyTransition(el, value ? 1 : -1, toggle, this.vm)
    } else {
      toggle()
    }
    function toggle () {
      el.style.display = value ? '' : 'none'
    }
  }
}
For more information send a message to info at phpclasses dot org.