diff --git a/packages/taro-runtime/src/dsl/common.ts b/packages/taro-runtime/src/dsl/common.ts index 5a3c5469287c..f4fe7f18c6a4 100644 --- a/packages/taro-runtime/src/dsl/common.ts +++ b/packages/taro-runtime/src/dsl/common.ts @@ -106,10 +106,10 @@ export function createPageConfig (component: any, pageName?: string, data?: Reco } const path = getPath(id, options) - + const router = isBrowser ? path : this.route || this.__route__ Current.router = { params: options, - path: addLeadingSlash(this.route || this.__route__), + path: addLeadingSlash(router), onReady: getOnReadyEventKey(id), onShow: getOnShowEventKey(id), onHide: getOnHideEventKey(id) @@ -161,10 +161,10 @@ export function createPageConfig (component: any, pageName?: string, data?: Reco Current.page = this as any this.config = pageConfig || {} const path = getPath(id, this.options) - + const router = isBrowser ? path : this.route || this.__route__ Current.router = { params: this.options, - path: addLeadingSlash(this.route || this.__route__), + path: addLeadingSlash(router), onReady: getOnReadyEventKey(id), onShow: getOnShowEventKey(id), onHide: getOnHideEventKey(id)