提交 916f7f2a 编写于 作者: Q qiang

fix: 安卓 nvue 页面 Promise 增加 finally 支持

上级 41ffc9e2
......@@ -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
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册