From c8bf91422a1005a7e79703cb6f90c23fc02a0ba5 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Tue, 28 Apr 2020 11:50:11 +0800 Subject: [PATCH] feat(v3): nvueCompiler=weex --- packages/uni-app-plus/dist/index.v3.js | 15 +++++++++++++-- packages/uni-cli-shared/lib/pages.js | 7 ------- packages/vue-cli-plugin-hbuilderx/index.js | 12 +++--------- packages/vue-cli-plugin-uni/lib/env.js | 4 ++-- .../lib/platforms/app-plus/app-config-service.js | 5 +++-- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index 3824d784bb..e2c2a1500c 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -7661,6 +7661,16 @@ var serviceContext = (function () { } }); + const backgroundColor = routeOptions.window.backgroundColor; + if (backgroundColor) { + if (!webviewStyle.background) { + webviewStyle.background = backgroundColor; + } + if (!webviewStyle.backgroundColorTop) { + webviewStyle.backgroundColorTop = backgroundColor; + } + } + const titleNView = parseTitleNView(routeOptions); if (titleNView) { if ( @@ -9000,7 +9010,8 @@ var serviceContext = (function () { cancelColor = '#000000', confirmText = '确定', confirmColor = '#3CC51F' - } = {}, callbackId) { + } = {}, callbackId) { + content = content || ' '; plus.nativeUI.confirm(content, (e) => { if (showCancel) { invoke$1(callbackId, { @@ -11280,7 +11291,7 @@ var serviceContext = (function () { } abort () { - invokeMethod('operateRequestTask', { + invokeMethod('operateDownloadTask', { downloadTaskId: this.id, operationType: 'abort' }); diff --git a/packages/uni-cli-shared/lib/pages.js b/packages/uni-cli-shared/lib/pages.js index de278a8854..055b58c5e1 100644 --- a/packages/uni-cli-shared/lib/pages.js +++ b/packages/uni-cli-shared/lib/pages.js @@ -129,14 +129,7 @@ function isValidPage (page, root = '') { if (subNVuePath) { subNVuePath = subNVue.path.split('?')[0] const subNVuePagePath = removeExt(path.join(root, subNVuePath)) - - // if (process.env.UNI_USING_NVUE_COMPILER) { process.UNI_NVUE_ENTRY[subNVuePagePath] = getNVueMainJsPath(subNVuePagePath) - // } else { - // process.UNI_NVUE_ENTRY[subNVuePagePath] = path.resolve(process.env.UNI_INPUT_DIR, - // subNVuePagePath + - // '.nvue') + '?entry' - // } } }) } diff --git a/packages/vue-cli-plugin-hbuilderx/index.js b/packages/vue-cli-plugin-hbuilderx/index.js index a6085f8fea..61616553b9 100644 --- a/packages/vue-cli-plugin-hbuilderx/index.js +++ b/packages/vue-cli-plugin-hbuilderx/index.js @@ -13,15 +13,9 @@ module.exports = (api, options) => { // 仅处理 app-plus 相关逻辑 } if ( - ( - !process.env.UNI_USING_V3 && - !process.env.UNI_USING_NATIVE && - !process.env.UNI_USING_V3_NATIVE - ) || - ( - process.env.UNI_USING_NATIVE && - !process.env.UNI_USING_NVUE_COMPILER - ) + !process.env.UNI_USING_V3 && + !process.env.UNI_USING_NATIVE && + !process.env.UNI_USING_V3_NATIVE ) { if (!fs.existsSync(path.resolve(process.env.UNI_HBUILDERX_PLUGINS, 'weapp-tools/lib/index.js'))) { console.error('请使用 HBuilderX 编译运行至 app-plus 平台') diff --git a/packages/vue-cli-plugin-uni/lib/env.js b/packages/vue-cli-plugin-uni/lib/env.js index d1b6c97e46..4b47d6ab2c 100644 --- a/packages/vue-cli-plugin-uni/lib/env.js +++ b/packages/vue-cli-plugin-uni/lib/env.js @@ -201,7 +201,7 @@ if (process.env.UNI_PLATFORM === 'app-plus') { platformOptions.usingComponents = true } process.env.UNI_OUTPUT_TMP_DIR = '' - isNVueCompiler = true // v3 目前仅支持 uni-app 模式 + // isNVueCompiler = true // v3 目前仅支持 uni-app 模式 } else if (platformOptions.renderer === 'native') { // 纯原生目前不提供 cache delete process.env.UNI_USING_CACHE @@ -255,7 +255,7 @@ if ( platformOptions.uniStatistics || {} ) - if (uniStatistics.enable !== false) { + if (uniStatistics.enable === true) { process.env.UNI_USING_STAT = true if (!process.UNI_STAT_CONFIG.appid && process.env.NODE_ENV === 'production') { console.log() diff --git a/packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js b/packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js index 32ff1c3e93..9815cafa3c 100644 --- a/packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js +++ b/packages/webpack-uni-pages-loader/lib/platforms/app-plus/app-config-service.js @@ -55,8 +55,9 @@ module.exports = function definePages (appJson) { const __uniRoutes = parseRoutes(appJson) delete appJson.page - delete appJson.usingComponents - delete appJson.nvueCompiler + delete appJson.usingComponents + // 保留nvueCompiler + // delete appJson.nvueCompiler // 保留renderer // delete appJson.renderer -- GitLab