Skip to content

Commit

Permalink
fix(app-plus): remove circular dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fxy060608 committed Oct 17, 2019
1 parent 26ea7a0 commit 695c742
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
26 changes: 15 additions & 11 deletions packages/uni-app-plus/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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
});
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 2 additions & 10 deletions src/platforms/app-plus/runtime/api/index.js
Original file line number Diff line number Diff line change
@@ -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'
8 changes: 8 additions & 0 deletions src/platforms/app-plus/runtime/api/require-native-plugin.js
Original file line number Diff line number Diff line change
@@ -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)
}
10 changes: 7 additions & 3 deletions src/platforms/app-plus/runtime/api/sub-nvue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { requireNativePlugin } from './index'
import {
requireNativePlugin
} from './require-native-plugin'

function wrapper (webview) {
webview.$processed = true
Expand All @@ -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
})
Expand Down Expand Up @@ -63,4 +67,4 @@ export function getSubNVueById (id) {
wrapper(webview)
}
return webview
}
}

0 comments on commit 695c742

Please sign in to comment.