From 695c742a46a482ff9049a14ce9e46893a4e599c0 Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Thu, 17 Oct 2019 19:40:07 +0800 Subject: [PATCH] fix(app-plus): remove circular dependency --- packages/uni-app-plus/dist/index.js | 26 +++++++++++-------- src/platforms/app-plus/runtime/api/index.js | 12 ++------- .../runtime/api/require-native-plugin.js | 8 ++++++ .../app-plus/runtime/api/sub-nvue.js | 10 ++++--- 4 files changed, 32 insertions(+), 24 deletions(-) create mode 100644 src/platforms/app-plus/runtime/api/require-native-plugin.js diff --git a/packages/uni-app-plus/dist/index.js b/packages/uni-app-plus/dist/index.js index 6e33c0b13..39935e5b6 100644 --- a/packages/uni-app-plus/dist/index.js +++ b/packages/uni-app-plus/dist/index.js @@ -499,6 +499,15 @@ var eventApi = /*#__PURE__*/Object.freeze({ $emit: $emit }); +function requireNativePlugin (pluginName) { + /* eslint-disable no-undef */ + if (typeof weex !== 'undefined') { + return weex.requireModule(pluginName) + } + /* eslint-disable no-undef */ + return __requireNativePlugin__(pluginName) +} + function wrapper$1 (webview) { webview.$processed = true; @@ -521,7 +530,9 @@ function wrapper$1 (webview) { } const maskColor = webview.__uniapp_mask; let maskWebview = webview.__uniapp_mask_id === '0' ? { - setStyle ({ mask }) { + setStyle ({ + mask + }) { requireNativePlugin('uni-tabview').setMask({ color: mask }); @@ -564,18 +575,11 @@ function getSubNVueById (id) { return webview } -function requireNativePlugin (pluginName) { - /* eslint-disable no-undef */ - if (typeof weex !== 'undefined') { - return weex.requireModule(pluginName) - } - /* eslint-disable no-undef */ - return __requireNativePlugin__(pluginName) -} + var api = /*#__PURE__*/Object.freeze({ - requireNativePlugin: requireNativePlugin, - getSubNVueById: getSubNVueById + getSubNVueById: getSubNVueById, + requireNativePlugin: requireNativePlugin }); const MPPage = Page; diff --git a/src/platforms/app-plus/runtime/api/index.js b/src/platforms/app-plus/runtime/api/index.js index 0e956fdbc..4d999267f 100644 --- a/src/platforms/app-plus/runtime/api/index.js +++ b/src/platforms/app-plus/runtime/api/index.js @@ -1,10 +1,2 @@ -export function requireNativePlugin (pluginName) { - /* eslint-disable no-undef */ - if (typeof weex !== 'undefined') { - return weex.requireModule(pluginName) - } - /* eslint-disable no-undef */ - return __requireNativePlugin__(pluginName) -} - -export * from './sub-nvue' +export * from './sub-nvue' +export * from './require-native-plugin' diff --git a/src/platforms/app-plus/runtime/api/require-native-plugin.js b/src/platforms/app-plus/runtime/api/require-native-plugin.js new file mode 100644 index 000000000..7ebf9f8b8 --- /dev/null +++ b/src/platforms/app-plus/runtime/api/require-native-plugin.js @@ -0,0 +1,8 @@ +export function requireNativePlugin (pluginName) { + /* eslint-disable no-undef */ + if (typeof weex !== 'undefined') { + return weex.requireModule(pluginName) + } + /* eslint-disable no-undef */ + return __requireNativePlugin__(pluginName) +} diff --git a/src/platforms/app-plus/runtime/api/sub-nvue.js b/src/platforms/app-plus/runtime/api/sub-nvue.js index d3cfa15a3..dd2d2a63e 100644 --- a/src/platforms/app-plus/runtime/api/sub-nvue.js +++ b/src/platforms/app-plus/runtime/api/sub-nvue.js @@ -1,4 +1,6 @@ -import { requireNativePlugin } from './index' +import { + requireNativePlugin +} from './require-native-plugin' function wrapper (webview) { webview.$processed = true @@ -22,7 +24,9 @@ function wrapper (webview) { } const maskColor = webview.__uniapp_mask let maskWebview = webview.__uniapp_mask_id === '0' ? { - setStyle ({ mask }) { + setStyle ({ + mask + }) { requireNativePlugin('uni-tabview').setMask({ color: mask }) @@ -63,4 +67,4 @@ export function getSubNVueById (id) { wrapper(webview) } return webview -} +} -- GitLab