-
Notifications
You must be signed in to change notification settings - Fork 25
/
yywebview.we
71 lines (65 loc) · 1.97 KB
/
yywebview.we
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
63
64
65
66
67
68
69
70
71
<template>
<div class="wrapper">
<web class="web" src="{{src}}" style="height:{{height}};" onpagestart="pagestart" onpagefinish="pagefinish" onerror="error"></web>
</div>
</template>
<style>
.text{
font-size:26;
}
.web{
flex:1;
}
</style>
<script>
require('./components-add/wxc-navpage.we');
//background-color="#0A60FE" title-color="#fff" left-item-color="#fff"
module.exports = {
data: {
src: '',
width: 0,
height: 0,
src: '',
title: '测试页面',
leftTitle:'',
},
created: function(){
var config = this.$getConfig();
this.width = config.env.deviceWidth;
this.height = config.env.deviceHeight;
var url = config.bundleUrl;
this.src = this._getUrl(url, 'weixin_url');
this.title = decodeURIComponent(this._getUrlParam(url, 'weixin_title'));
this.$on('naviBar.leftItem.click',function(e){
//pop back
var params = {
'animated' : 'true',
}
var navigator = require('@weex-module/navigator');
navigator.pop(params, function(e) {});
});
},
methods: {
pagestart: function(){
//TODO: loading
},
pagefinish: function(){
//TODO: close loading
},
error: function(){
//TODO: show infowindow
},
_getUrl: function(url, key){
var isExits = url.indexOf(key);
if(isExits > -1){
return url.split('url=')[1];
}
},
_getUrlParam: function(url, key){
var reg = new RegExp('[?|&]' + key + '=([^&]+)');
var match = url.match(reg);
return match && match[1];
}
}
};
</script>