模拟 v-show
// 绑定的值为false,display为none,值为true,display为""
Vue.directive('myshow', {
bind (el, binding, vnode, oldVnode) {
var display = binding.value ? '' : 'none';
el.style.display = display;
},
update (el, binding, vnode, oldVnode) {
var display = binding.value ? '' : 'none';
el.style.display = display;
}
})