binarymann
V2EX  ›  Vue.js

有木有办法动态将一段 CSS 样式定义绑定到一个组件上呢?

  •  
  •   binarymann · Jan 15, 2019 · 2308 views
    This topic created in 2694 days ago, the information mentioned may be changed or developed.

    不是文档里面说得简单的内联样式,而是这种样式:

    .my-dynamic-class-def {
      background: red;
    }
    
    2 replies    2019-01-26 00:07:03 +08:00
    noe132
        1
    noe132  
       Jan 16, 2019   ❤️ 1
    1. 直接给组件加 class 不行么?
    2. 参考一下 css module
    ohyeahhh
        2
    ohyeahhh  
       Jan 26, 2019
    v-bind 不行吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1116 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:21 · PVG 02:21 · LAX 11:21 · JFK 14:21
    ♥ Do have faith in what you're doing.