From 2e671e79718ca4311d52f0f52fcd2dac824b4b59 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 11 Jun 2019 15:48:24 +0800 Subject: [PATCH] feat(mp-toutiao): add route (getCurrentPages) --- packages/uni-mp-toutiao/dist/index.js | 10 +++++++++- packages/uni-mp-toutiao/package.json | 2 +- src/platforms/mp-toutiao/runtime/wrapper/app-parser.js | 10 +++++++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/packages/uni-mp-toutiao/dist/index.js b/packages/uni-mp-toutiao/dist/index.js index cdc7696c..c8ad8c95 100644 --- a/packages/uni-mp-toutiao/dist/index.js +++ b/packages/uni-mp-toutiao/dist/index.js @@ -1192,12 +1192,20 @@ function handleLink$1 ({ vm.__call_hook('onReady'); } -function parseApp (vm) { +function parseApp (vm) { Vue.prototype._$fallback = true; // 降级(调整原 vue 的部分生命周期,如 created,beforeMount,inject,provide) Vue.mixin({ created () { // 处理 injections,头条 triggerEvent 是异步,且触发时机很慢,故延迟 relation 设置 if (this.mpType !== 'app') { + if ( + this.mpType === 'page' && + !this.$scope.route && + this.$scope.__route__ + ) { + this.$scope.route = this.$scope.__route__; + } + initRefs$1(this); this.__init_injections(this); diff --git a/packages/uni-mp-toutiao/package.json b/packages/uni-mp-toutiao/package.json index 1c2bbef6..d2ef67fe 100644 --- a/packages/uni-mp-toutiao/package.json +++ b/packages/uni-mp-toutiao/package.json @@ -1,6 +1,6 @@ { "name": "@dcloudio/uni-mp-toutiao", - "version": "0.0.339", + "version": "0.0.340", "description": "uni-app mp-toutiao", "main": "dist/index.js", "scripts": { diff --git a/src/platforms/mp-toutiao/runtime/wrapper/app-parser.js b/src/platforms/mp-toutiao/runtime/wrapper/app-parser.js index 6da217e2..a7103adc 100644 --- a/src/platforms/mp-toutiao/runtime/wrapper/app-parser.js +++ b/src/platforms/mp-toutiao/runtime/wrapper/app-parser.js @@ -7,12 +7,20 @@ import { initRefs } from './util' -export default function parseApp (vm) { +export default function parseApp (vm) { Vue.prototype._$fallback = true // 降级(调整原 vue 的部分生命周期,如 created,beforeMount,inject,provide) Vue.mixin({ created () { // 处理 injections,头条 triggerEvent 是异步,且触发时机很慢,故延迟 relation 设置 if (this.mpType !== 'app') { + if ( + this.mpType === 'page' && + !this.$scope.route && + this.$scope.__route__ + ) { + this.$scope.route = this.$scope.__route__ + } + initRefs(this) this.__init_injections(this) -- GitLab