Skip to content

Commit

Permalink
补充switchbar部分提交
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcuijuan committed Oct 15, 2020
1 parent 3c7af01 commit 0dea10d
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 42 deletions.
4 changes: 2 additions & 2 deletions examples/mpx-webview/H5/webviewbridge.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<script>
import getInnerListeners, { getCustomEvent } from './getInnerListeners'
import { redirectTo, navigateTo, navigateBack, reLaunch } from '@mpxjs/api-proxy/src/web/api/index'
import { redirectTo, navigateTo, navigateBack, reLaunch, switchTab} from '@mpxjs/api-proxy/src/web/api/index'
const eventLoad = 'load'
const eventError = 'error'
Expand Down Expand Up @@ -81,6 +81,10 @@
this.isActived = false
redirectTo(value)
break
case 'switchTab':
this.isActived = false
switchTab(value)
break
case 'reLaunch':
this.isActived = false
reLaunch(value)
Expand Down
16 changes: 6 additions & 10 deletions packages/webview-bridge/dist/webviewbridge.esm.browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* mpxjs webview bridge v2.5.30
* mpxjs webview bridge v2.6.11
* (c) 2020 @mpxjs team
* @license Apache
*/
Expand Down Expand Up @@ -92,7 +92,7 @@ if (systemUA.indexOf('AlipayClient') > -1) {
}, '*');
}

function postMessage(type, data) {
function postMessage (type, data) {
let eventType;
switch (type) {
case 'postMessage':
Expand All @@ -107,9 +107,9 @@ function postMessage(type, data) {
case 'redirectTo':
eventType = 'redirectTo';
break
// case 'switchTab':
// eventType = 'switchTab'
// break
case 'switchTab':
eventType = 'switchTab';
break
case 'reLaunch':
eventType = 'reLaunch';
break
Expand Down Expand Up @@ -171,11 +171,7 @@ const getWebviewApi = (sdkReady) => {

webviewApiList[item] = (...args) => {
if (env === 'web') {
if (item === 'switchTab') {
console.log(`此环境不支持 ${item} 方法`);
return
}
return postMessage(item, ...args);
return postMessage(item, ...args)
// console.log(`${env}小程序不支持 ${item} 方法`)
} else {
return sdkReady.then(() => {
Expand Down
Loading

0 comments on commit 0dea10d

Please sign in to comment.