weex
weex copied to clipboard
请问weex中如何实现js间页面跳转或者网站访问
请问we中如何去访问一个网页,必需要用webview直接加载嚒? 有没有类似href的参数设定,点击后可以直接跳转? 两个js间的页面跳转呢以及两者间数值如何传递?
@Hanks10100
webview我试过了,应该只是加载了所指的网页内容,并没有实现跳转。
<a>的话
<div> <a href="http://www.163.com" style="width:100;"> <text class="text" style="width:80;"> 163 </text> </a> </div>
我测试后发现PC上没问题,可以跳转到163页面,但是加上--qr手机(android)扫描二维码后,点击跳转,地址栏上确实是www.163.com,但是内容却是空白,请问这样写有问题么? 感谢~
你这种情况的话应该用 <web> 标签,通过改变 src 的方式更新 URL。
代码例子如下:
<template>
<div class="wrapper">
<text class="button" onclick="go">Go to 163</text>
<web class="content" src="{{url}}"></web>
</div>
</template>
<script>
module.exports = {
data: {
url: 'https://m.taobao.com'
},
methods: {
go: function() {
this.url = 'http://www.163.com'
}
}
}
</script>
<style>
.wrapper {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.button {
width: 350;
height: 60;
line-height: 60;
margin-left: 200;
margin-right: 200;
margin-top: 10;
margin-bottom: 10;
text-align: center;
border-color: #666666;
border-width: 1;
color: #666666;
}
.content {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin-top: 80;
}
</style>