From 916f7f2a67d878d15465fe5c52dc3f36051f1805 Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 23 Jun 2020 18:46:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=89=E5=8D=93=20nvue=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20Promise=20=E5=A2=9E=E5=8A=A0=20finally=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/webpack-uni-nvue-loader/lib/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js b/packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js index b24ed39b1..bd56ba021 100644 --- a/packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js +++ b/packages/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/main.js @@ -59,6 +59,17 @@ module.exports = function (content, map) { ${statCode} import 'uni-app-style' import App from './${normalizePath(params.page)}.nvue?mpType=page' + if (typeof Promise !== 'undefined' && !Promise.prototype.finally) { + Promise.prototype.finally = function(callback) { + const promise = this.constructor + return this.then( + value => promise.resolve(callback()).then(() => value), + reason => promise.resolve(callback()).then(() => { + throw reason + }) + ) + } + } App.mpType = 'page' App.route = '${params.page}' App.el = '#root' @@ -73,4 +84,4 @@ module.exports = function (content, map) { const automatorCode = process.env.UNI_AUTOMATOR_WS_ENDPOINT ? 'import \'@dcloudio/uni-app-plus/dist/automator\';' : '' return automatorCode + statCode + content -} +} -- GitLab