2
0
Эх сурвалжийг харах

handle !important in static styles (fix #4306)

Evan You 9 жил өмнө
parent
commit
ac060163c3

+ 3 - 0
src/platforms/web/runtime/modules/style.js

@@ -4,10 +4,13 @@ import { cached, camelize, extend } from 'shared/util'
 import { normalizeStyleBinding, getStyle } from 'web/util/style'
 
 const cssVarRE = /^--/
+const importantRE = /\s*!important$/
 const setProp = (el, name, val) => {
   /* istanbul ignore if */
   if (cssVarRE.test(name)) {
     el.style.setProperty(name, val)
+  } else if (importantRE.test(val)) {
+    el.style.setProperty(name, val.replace(importantRE, ''), 'important')
   } else {
     el.style[normalize(name)] = val
   }