diff --git a/packages/uni-app-plus/dist/uni-app-view.umd.js b/packages/uni-app-plus/dist/uni-app-view.umd.js index 5b1b2f0bcdbf417c376734e2a0e4096b84833bbd..85e3bd934485df6ecb7d7b7d654049bb0c8f0e1f 100644 --- a/packages/uni-app-plus/dist/uni-app-view.umd.js +++ b/packages/uni-app-plus/dist/uni-app-view.umd.js @@ -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); } diff --git a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts index d1ca0b1c35027300deeecc8de3e0982bbc739377..75789d39a4062a7c82dae42c5689c7d0552a3bee 100644 --- a/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts +++ b/packages/uni-app-plus/src/view/framework/dom/components/UniComponent.ts @@ -1,4 +1,4 @@ -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) }