提交 d2980709 编写于 作者: fxy060608's avatar fxy060608

fix(app): requireNativePlugin

......@@ -73,9 +73,15 @@ function getSsrGlobalData() {
return uniShared.sanitise(globalData);
}
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
}
function resolveEasycom(component, easycom) {
......@@ -151,6 +157,7 @@ exports.onTabItemTap = onTabItemTap;
exports.onThemeChange = onThemeChange;
exports.onUnhandledRejection = onUnhandledRejection;
exports.onUnload = onUnload;
exports.requireNativePlugin = requireNativePlugin;
exports.resolveEasycom = resolveEasycom;
exports.shallowSsrRef = shallowSsrRef;
exports.ssrRef = ssrRef;
......@@ -28,6 +28,9 @@ declare interface CustomShareTimeline {
imageUrl?: string;
}
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
export declare function getCurrentSubNVue(): any;
export declare function getSsrGlobalData(): any;
......@@ -157,6 +160,8 @@ declare interface ReferrerInfo {
extraData?: any;
}
export declare function requireNativePlugin(name: string): any;
declare interface ResizeOption {
size: {
windowWidth: number;
......
......@@ -41,9 +41,15 @@ function getSsrGlobalData() {
return sanitise(globalData);
}
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id);
}
function requireNativePlugin(name) {
return weex.requireModule(name);
}
function resolveEasycom(component, easycom) {
......@@ -93,4 +99,4 @@ const onNavigationBarSearchInputConfirmed =
const onNavigationBarSearchInputFocusChanged =
/*#__PURE__*/ createHook(ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED);
export { getCurrentSubNVue, getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, resolveEasycom, shallowSsrRef, ssrRef };
export { getCurrentSubNVue, getSsrGlobalData, onAddToFavorites, onBackPress, onError, onHide, onLaunch, onLoad, onNavigationBarButtonTap, onNavigationBarSearchInputChanged, onNavigationBarSearchInputClicked, onNavigationBarSearchInputConfirmed, onNavigationBarSearchInputFocusChanged, onPageNotFound, onPageScroll, onPullDownRefresh, onReachBottom, onReady, onResize, onShareAppMessage, onShareTimeline, onShow, onTabItemTap, onThemeChange, onUnhandledRejection, onUnload, requireNativePlugin, resolveEasycom, shallowSsrRef, ssrRef };
/**
* uni 对象是跨实例的,而此处列的 API 均是需要跟当前实例关联的,比如 requireNativePlugin 获取 dom 时,依赖当前 weex 实例
*/
export function getCurrentSubNVue() {
// @ts-ignore
return uni.getSubNVueById(plus.webview.currentWebview().id)
}
export function requireNativePlugin(name: string) {
return weex.requireModule(name)
}
......@@ -10,6 +10,7 @@ export function initAppProvide() {
'window.crypto': cryptoDefine,
'global.crypto': cryptoDefine,
'uni.getCurrentSubNVue': ['@dcloudio/uni-app', 'getCurrentSubNVue'],
'uni.requireNativePlugin': ['@dcloudio/uni-app', 'requireNativePlugin'],
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册