webview.vue
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<template>
<page-meta>
<navigation-bar :title="nbTitle" :front-color="nbFrontColor" :background-color="nbBackgroundColor" />
</page-meta>
<view>
<view v-if="url">
<web-view :webview-styles="webviewStyles" :src="url" @message="handleGetMessage"></web-view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
nbTitle: '',
nbFrontColor: '#000000',
nbBackgroundColor: '#ffffff',
url: "",
webviewStyles: {
progress: {
color: '#FF3333'
}
}
}
},
onLoad(option) {
console.log(option, new Date().getTime());
if (option.type == 'treary') {
this.url = decodeURIComponent(option.url);
console.log('123',this.url);
} else if (option.type == 'cc') {
} else {
this.url = `${option.url}?time=${new Date().getTime()}`;
}
this.nbTitle = option.navtitle;
},
methods: {
reloadPage(redirectUrl) {
console.log('---webview reloadPage', redirectUrl)
this.url = redirectUrl
},
handleGetMessage(e) {
console.log('ddd', e)
// if (e.detail.data[0].result == 'success') {
// wx.navigateTo({
// url: '/pages/redirect/bizpage'
// })
// }
},
}
}
</script>
<style lang="scss" scoped>
</style>