优化返回

This commit is contained in:
java110 2021-09-04 19:20:29 +08:00
parent 7cbcb9d692
commit b089996df9
3 changed files with 33 additions and 3 deletions

View File

@ -42,6 +42,8 @@ const ACTION_NAVIGATE_TO_PAGE = "navigateToPage";
const ACTION_PAY_ORDER = "payOrder";
const ACTION_SET_TITLE = "setTitle";
const ACTION_NAVIGATE_HOME = "navigateHome";
const ACTION_NAVIGATE_BACK = "navigateBack";
@ -217,4 +219,13 @@ export function reciveMessage(event, that) {
  title:_data.title
})
}
else if (_data.action == ACTION_NAVIGATE_BACK) {
//_data.url = encodeUrl(_data.url);
setStorageSync('_go_back_refresh',1);
uni.navigateBack({
delta:1
})
}
}

View File

@ -32,6 +32,15 @@
_that.url = conf.mallUrl+"#/pages/homemaking/index?mallFrom=HC&hcCommunityId="+_that.communityId;
})
},
onShow() {
let _goBackRefresh = getStorageSync('_go_back_refresh');
if(_goBackRefresh == 1){
let wv = this.$refs.webview
wv.reload(true);
}
setStorageSync('_go_back_refresh',0)
},
methods: {
onReciveMessage: function(event) {

View File

@ -10,7 +10,10 @@
reciveMessage,
getHcCode
} from '../../api/webView/webViewApi.js'
import {
getStorageSync,
setStorageSync
} from '../../utils/StorageUtil.js'
import {
decodeUrl
} from '../../utils/UrlUtil.js';
@ -27,8 +30,6 @@
let _that = this;
let _url = options.url;
_url = decodeUrl(_url);
//hcCode
this.vc.getCurCommunity()
.then(function(_communityInfo) {
@ -38,6 +39,15 @@
_that.url = conf.mallUrlIndexPage + "&hcCommunityId=" + _that.communityId;
})
},
onShow() {
let _goBackRefresh = getStorageSync('_go_back_refresh');
if (_goBackRefresh == 1) {
let wv = this.$refs.webview
wv.currentWebview().reload(true);
}
setStorageSync('_go_back_refresh', 0);
},
methods: {
onReciveMessage: function(event) {