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

fix(app): style

上级 a3156716
......@@ -14725,6 +14725,9 @@
this.setAttr(n, a2[n]);
});
}
if (hasOwn$1(nodeJson, "s")) {
this.setAttr("style", nodeJson.s);
}
if (e2) {
Object.keys(e2).forEach((n) => {
this.addEvent(n, e2[n]);
......@@ -14746,6 +14749,16 @@
if (this.$) {
patchVShow(this.$, value);
}
} else if (name === ATTR_STYLE) {
const newStyle = decodeAttr(value);
const oldStyle = this.$props.style;
if (isPlainObject(newStyle) && isPlainObject(oldStyle)) {
Object.keys(newStyle).forEach((n) => {
oldStyle[n] = newStyle[n];
});
} else {
this.$props.style = newStyle;
}
} else {
this.$props[name] = decodeAttr(value);
}
......
import { hasOwn } from '@vue/shared'
import { hasOwn, isPlainObject } from '@vue/shared'
import {
App,
Component,
......@@ -9,6 +9,7 @@ import {
flushPostFlushCbs,
} from 'vue'
import {
ATTR_STYLE,
ATTR_V_SHOW,
formatLog,
parseEventName,
......@@ -70,6 +71,9 @@ export class UniComponent extends UniNode {
this.setAttr(n, a[n])
})
}
if (hasOwn(nodeJson, 's')) {
this.setAttr('style', nodeJson.s)
}
if (e) {
Object.keys(e).forEach((n) => {
this.addEvent(n, e[n])
......@@ -95,6 +99,16 @@ export class UniComponent extends UniNode {
if (this.$) {
patchVShow(this.$ as VShowElement, value)
}
} else if (name === ATTR_STYLE) {
const newStyle = decodeAttr(value)
const oldStyle = this.$props.style
if (isPlainObject(newStyle) && isPlainObject(oldStyle)) {
Object.keys(newStyle).forEach((n) => {
;(oldStyle as any)[n] = (newStyle as any)[n]
})
} else {
this.$props.style = newStyle
}
} else {
this.$props[name] = decodeAttr(value)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册