Просмотр исходного кода

fix(transition): handle local-formatted floats in toMs function. (#8495)

fix #4894
Phablulo Joel 7 лет назад
Родитель
Сommit
59d4351ad8
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      src/platforms/web/runtime/transition-util.js

+ 5 - 1
src/platforms/web/runtime/transition-util.js

@@ -181,6 +181,10 @@ function getTimeout (delays: Array<string>, durations: Array<string>): number {
   }))
 }
 
+// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
+// in a locale-dependent way, using a comma instead of a dot.
+// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
+// as a floor function) causing unexpected behaviors
 function toMs (s: string): number {
-  return Number(s.slice(0, -1)) * 1000
+  return Number(s.slice(0, -1).replace(',', '.')) * 1000
 }