rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Style and Class binding improvements

Open CyberAP opened this issue 5 years ago • 2 comments
trafficstars

Rendered

Introduce a couple of improvements to Style and Class bindings:

  • Secondary argument for direct prop-value bindings

    <input :class:is-active="isActive">
    
  • Modifiers for secondary style arguments

    <input :style:custom-property.prop="customPropertyValue">
    <input :style:width.px="width">
    

CyberAP avatar Jul 22 '20 23:07 CyberAP

This was asked for before at https://github.com/vuejs/vue/issues/4956 Same for implicit prop values https://github.com/vuejs/vue/pull/2877

Given the existing syntax for directives (like v-bind) this introduces a custom attribute named class:property (property being dynamic) and a custom behavior for v-bind, which ironically helps to making things overcomplicated which is your first point in motivation

posva avatar Jul 23 '20 07:07 posva

It does not introduce a custom attribute and is a syntax sugar for an existing object configuration for v-bind. That's why it said that users who use render functions won't be affected by this change.

CyberAP avatar Jul 23 '20 10:07 CyberAP