web标签无法拖动
使用web标签加载了一个页面进去,发现不能拖动,是还没支持还是我引入有误呢?
- oc
- weexsdk(git)
<scroller if="{{page.trips.shown}}">
<web class="web" id="webview" src="{{url}}"></web>
</scroller>
你说的是‘滚动’吧 web控件本身就是可以滚动 就跟浏览器一样 没必要放到scroller里面
@sospartan
在web里面嵌入了一个地图,但是在地图上拖动无效,用浏览器打开正常,scroller标签应该不影响这个功能吧
明白了 这样是有问题 使用的url能贴出来么
@sospartan
地址是这里: http://implements.io/footprint
换了其他搜索网站也是一样的,无法点击,也无法输入如何信息。
@sospartan 完整的tpl代码:
<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white">
<web class="web" id="webview" src="https://www.baidu.com"></web>
<wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
</wxc-navpage>
</template>
@zshshr 会跟进这个问题 已经在看了
嗯,我是发现,直接使用正常,但是用在navpage里面就不正常的
@thonatos 贴一个能复现问题的最小子页面的代码
@YorkShen
<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white">
<web class="web" id="webview" src="http://implements.io/footprint"></web>
</template>
<style>
.web{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height:750;
}
</style>
<script>
require('weex-components');
var webview = require('@weex-module/webview');
module.exports = {
data: {
nav:{
height: 144,
title: 'Bianca 🍭'
}
},
created: function() {
},
methods: {
ready: function (e) {
},
go:function(){
var $webview = require('@weex-module/webview');
var webElement = this.$el('webview');
$webview.reload(webElement.ref);
}
},
}
</script>
webview无法进行任何操作
@thonatos 存在两个问题
- wxc-navpage没有结束标签
- 目前weex android不支持emoji,所以data.nav.title会导致渲染异常。
以下代码可以正常渲染。
<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title-color="white">
<web class="web" id="webview" src="http://implements.io/footprint"></web>
</wxc-navpage>
</template>
<style>
.web{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
height:750;
}
</style>
<script>
require('weex-components');
var webview = require('@weex-module/webview');
module.exports = {
data: {
nav:{
height: 144,
title: 'Bianca 🍭'
}
},
created: function() {
},
methods: {
ready: function (e) {
},
go:function(){
var $webview = require('@weex-module/webview');
var webElement = this.$el('webview');
$webview.reload(webElement.ref);
}
},
}
</script>
@YorkShen
我发现了,不是你说的问题,是wxc-tabbar嵌套在wxc-navpage里就出错了,另外,我是iOS
@cxfeng1 看下这个问题
@YorkShen
昨天忘记贴代码了,最后正常的代码是这样,就是需要在wxc-tabbar外面再套一层。
<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white">
<div class="wrap">
<web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>
// stories
<stories if="{{page.stories.shown}}" msg="{{page.stories.msg}}"></stories>
// about
<about if="{{page.about.shown}}"></about>
</div>
<div style="flex-direction: column;">
<wxc-tabbar tab-items={{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
</div>
</wxc-navpage>
</template>
<style>
.wrap{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 90;
}
.web{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
下面这样就不正常,你们处理一下吧:
<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white">
<div class="wrap">
<web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>
</div>
// stories
<stories if="{{page.stories.shown}}" msg="{{page.stories.msg}}"></stories>
// about
<about if="{{page.about.shown}}"></about>
<wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
</wxc-navpage>
</template>
<style>
.wrap{
width: 750;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.web{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin-top: 0;
margin-bottom: 70;
}
</style>
@thonatos
问题
这个不是tabbar的bug,是书写的问题 webview 在tabbar 之前,表示tabbar在上面,tabbar的嵌入的content会覆盖webview,webview无法点击。 将tabbar放在< div > < / div > 这个容器的高度为0,tabbar的content的高度为0,虽然webview可以拖动,当时tabbar的内容是不能呈现的
现象
tabbar在前面现象截图
div 容器为高度为0现象截图

针对你的问题,下面的代码你可以参考下(调换 tabbar和webview的位置)
<wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
......
<div class="wrap">
<web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>
</div>
@kfeagle
👌,O(∩_∩)O谢谢
最好有一个地方可以说明加z-index关系(可能我没找到...),解释的很详细,赞一个!
This issue is resolved.