diff --git a/packages/uni-mp-alipay/src/runtime/createPage.ts b/packages/uni-mp-alipay/src/runtime/createPage.ts index 3f31cd84df0..538f67d6095 100644 --- a/packages/uni-mp-alipay/src/runtime/createPage.ts +++ b/packages/uni-mp-alipay/src/runtime/createPage.ts @@ -41,7 +41,12 @@ export function initCreatePage() { vueOptions = vueOptions.default || vueOptions const pageOptions: tinyapp.PageOptions = { onLoad(query) { - this.options = query + if (__X__) { + // query并非多层级结构,无需递归处理 + this.options = new UTSJSONObject(query || {}) + } else { + this.options = query + } this.$page = { fullPath: addLeadingSlash(this.route + stringifyQuery(query)), } diff --git a/packages/uni-mp-baidu/src/runtime/parsePageOptions.ts b/packages/uni-mp-baidu/src/runtime/parsePageOptions.ts index 9c638d8b12c..30e88eff805 100644 --- a/packages/uni-mp-baidu/src/runtime/parsePageOptions.ts +++ b/packages/uni-mp-baidu/src/runtime/parsePageOptions.ts @@ -31,7 +31,13 @@ export function parse(pageOptions: MPComponentOptions) { ;(this as any)._$loaded = true const copyQuery = extend({}, query) delete copyQuery.__id__ - ;(this as any).options = copyQuery + + if (__X__) { + // query并非多层级结构,无需递归处理 + ;(this as any).options = new UTSJSONObject(copyQuery || {}) + } else { + ;(this as any).options = copyQuery + } ;(this as any).pageinstance.$page = (this as any).$page = { fullPath: '/' + (this as any).pageinstance.route + stringifyQuery(copyQuery), diff --git a/packages/uni-mp-core/src/runtime/page.ts b/packages/uni-mp-core/src/runtime/page.ts index 9e9c69b7c9e..39dd4db60f0 100644 --- a/packages/uni-mp-core/src/runtime/page.ts +++ b/packages/uni-mp-core/src/runtime/page.ts @@ -49,7 +49,12 @@ function parsePage( this: CustomComponentInstanceProperty, query: Record ) { - ;(this as any).options = query + if (__X__) { + // query并非多层级结构,无需递归处理 + ;(this as any).options = new UTSJSONObject(query || {}) + } else { + ;(this as any).options = query + } ;(this as any).$page = { fullPath: addLeadingSlash((this as any).route + stringifyQuery(query)), } diff --git a/packages/uni-mp-jd/src/runtime/createPage.ts b/packages/uni-mp-jd/src/runtime/createPage.ts index 73ca338b02b..4bfd5440de6 100644 --- a/packages/uni-mp-jd/src/runtime/createPage.ts +++ b/packages/uni-mp-jd/src/runtime/createPage.ts @@ -43,7 +43,12 @@ function parsePage( this: CustomComponentInstanceProperty, query: Record ) { - ;(this as any).options = query + if (__X__) { + // query并非多层级结构,无需递归处理 + ;(this as any).options = new UTSJSONObject(query || {}) + } else { + ;(this as any).options = query + } ;(this as any).$page = { fullPath: addLeadingSlash((this as any).route + stringifyQuery(query)), } diff --git a/packages/uni-mp-xhs/src/runtime/createPage.ts b/packages/uni-mp-xhs/src/runtime/createPage.ts index 997be3658ac..37109c9c3c3 100644 --- a/packages/uni-mp-xhs/src/runtime/createPage.ts +++ b/packages/uni-mp-xhs/src/runtime/createPage.ts @@ -35,7 +35,12 @@ export function initCreatePage() { vueOptions = vueOptions.default || vueOptions const pageOptions: tinyapp.PageOptions = { onLoad(query) { - this.options = query + if (__X__) { + // query并非多层级结构,无需递归处理 + this.options = new UTSJSONObject(query || {}) + } else { + this.options = query + } this.$page = { fullPath: addLeadingSlash(this.route + stringifyQuery(query)), }