mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
51 lines
911 B
Vue
51 lines
911 B
Vue
<template>
|
||
<view class="h5-html">
|
||
<web-view ref="webview" :src="url" @message="reciveMessage"></web-view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import conf from '../../conf/config.js'
|
||
import {decodeUrl} from '../../utils/UrlUtil.js'
|
||
import {
|
||
reciveMessage
|
||
} from '../../api/webView/webViewApi.js'
|
||
export default {
|
||
data() {
|
||
return {
|
||
url: ''
|
||
}
|
||
},
|
||
mounted() {
|
||
// #ifdef H5
|
||
window.addEventListener("message", this.reciveMessage);
|
||
// #endif
|
||
},
|
||
onLoad(options) {
|
||
let _url = options.url;
|
||
_url = decodeUrl(_url);
|
||
if(_url.indexOf("http")>-1){
|
||
this.url = _url;
|
||
}else{
|
||
this.url = conf.mallUrl + '#' + _url;
|
||
}
|
||
|
||
console.log('_hcUrl',this.url);
|
||
|
||
},
|
||
methods: {
|
||
reciveMessage: function(event) {
|
||
console.log('商城回传的参数', event);
|
||
reciveMessage(event);
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.h5-html {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
</style>
|