forked from dcloudio/uni-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build uni runtime(app-plus add subNVue)
- Loading branch information
Showing
5 changed files
with
115 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export function requireNativePlugin (pluginName) { | ||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function wrapper (webview) { | ||
webview.$processed = true | ||
if (!webview.__uniapp_mask_id) { | ||
return | ||
} | ||
const maskColor = webview.__uniapp_mask | ||
const maskWebview = plus.webview.getWebviewById(webview.__uniapp_mask_id) | ||
const oldShow = webview.show | ||
const oldHide = webview.hide | ||
const oldClose = webview.close | ||
|
||
const showMask = function () { | ||
maskWebview.setStyle({ | ||
mask: maskColor | ||
}) | ||
} | ||
const closeMask = function () { | ||
maskWebview.setStyle({ | ||
mask: 'none' | ||
}) | ||
} | ||
webview.show = function (...args) { | ||
showMask() | ||
return oldShow.apply(webview, args) | ||
} | ||
webview.hide = function (...args) { | ||
closeMask() | ||
return oldHide.apply(webview, args) | ||
} | ||
webview.close = function (...args) { | ||
closeMask() | ||
return oldClose.apply(webview, args) | ||
} | ||
} | ||
|
||
export const subNVue = { | ||
getSubNVueById (id) { | ||
const webview = plus.webview.getWebviewById(id) | ||
if (webview && !webview.$processed) { | ||
wrapper(webview) | ||
} | ||
return webview | ||
} | ||
} |