Skip to content

24 - 激活的样式-指令 #732

Open
@XkSuperCool

Description

@XkSuperCool
const VActiveStyle = {
  handle(el, bindings) {
    const [style, fn] = bindings.value;
    if (fn()) {
      el.style.color = style.color;
    } else {
      el.style.color = ''
    }
  },

  beforeMount(el, bindings) {
    VActiveStyle.handle(el, bindings)
  },
  
  beforeUpdate(el, bindings) {
    VActiveStyle.handle(el, bindings)
  }
};

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions