提交 b246555c 编写于 作者: fxy060608's avatar fxy060608

fix: v-bind in CSS support rpx (#3884)

上级 6166895a
......@@ -29,6 +29,7 @@ import {
import { decodeAttr, isCssVar } from '../utils'
import { patchVShow, VShowElement } from '../directives/vShow'
import { initRenderjs } from '../renderjs'
import { normalizeStyleValue } from '../../../utils'
export class UniComponent extends UniNode {
declare $: UniCustomElement
......@@ -131,7 +132,7 @@ export class UniComponent extends UniNode {
this.$props.style = newStyle
}
} else if (isCssVar(name)) {
this.$.style.setProperty(name, value as string)
this.$.style.setProperty(name, normalizeStyleValue(value as string))
} else {
value = decodeAttr(this.$ || $(this.pid).$, value)
if (!this.wxsPropsInvoke(name, value, true)) {
......
......@@ -23,6 +23,7 @@ import {
import { decodeAttr, isCssVar } from '../utils'
import { patchVShow, VShowElement } from '../directives/vShow'
import { initRenderjs } from '../renderjs'
import { normalizeStyleValue } from '../../../utils'
export class UniElement<T extends object> extends UniNode {
declare $: UniCustomElement
......@@ -137,7 +138,7 @@ export class UniElement<T extends object> extends UniNode {
if (this.$propNames.indexOf(name) !== -1) {
;(this.$props as any)[name] = value
} else if (isCssVar(name)) {
this.$.style.setProperty(name, value as string)
this.$.style.setProperty(name, normalizeStyleValue(value as string))
} else {
if (!this.wxsPropsInvoke(name, value)) {
this.$.setAttribute(name, value as string)
......
......@@ -10068,7 +10068,7 @@ function setVarsOnNode(el, vars) {
if (el.nodeType === 1) {
const style = el.style;
for (const key in vars) {
style.setProperty(`--${key}`, vars[key]);
style.setProperty(`--${key}`, normalizeRpx(vars[key]));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册